/* ===== LANG BUTTON ===== */
.lang-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--muted);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.lang-btn:hover {
  background: rgba(124,58,237,0.2);
  border-color: var(--accent2);
  color: #fff;
}

/* ===== HEADER NAV ===== */
.header-nav {
  margin-left: auto;
  display: flex;
  gap: 20px;
}
.header-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.header-nav a:hover,
.header-nav a.active {
  color: #fff;
  border-bottom-color: var(--accent2);
}

/* ===== PROFILE HERO ===== */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 48px 0 32px;
  flex-wrap: wrap;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 96px;
  height: 96px;
  background: var(--card);
  border: 3px solid rgba(124,58,237,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  line-height: 1;
  user-select: none;
}

.avatar-change-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.avatar-change-btn:hover { background: var(--accent2); }

.profile-info {
  flex: 1;
  min-width: 200px;
}

.profile-name {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}

.name-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 18px;
  transition: color 0.2s;
}
.name-edit-btn:hover { color: var(--accent2); }

.profile-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 20px;
  text-align: center;
  min-width: 80px;
}

.stat-val {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.stat-lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== XP BAR ===== */
.xp-section {
  margin-bottom: 48px;
}

.xp-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.xp-bar {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ===== SECTION ===== */
.section {
  margin-bottom: 56px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ach-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
}

/* ===== ACHIEVEMENTS GRID ===== */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.ach-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: border-color 0.2s, transform 0.2s;
}

.ach-card.unlocked {
  border-color: rgba(124,58,237,0.35);
}

.ach-card.unlocked[data-rarity="uncommon"] { border-color: rgba(74,222,128,0.35); }
.ach-card.unlocked[data-rarity="rare"]     { border-color: rgba(96,165,250,0.35); }
.ach-card.unlocked[data-rarity="legendary"] {
  border-color: rgba(245,158,11,0.5);
  background: linear-gradient(135deg, var(--card), rgba(245,158,11,0.08));
  box-shadow: 0 0 20px rgba(245,158,11,0.1);
}

.ach-card.unlocked:hover {
  transform: translateY(-2px);
}

.ach-card.locked {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.ach-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}

.ach-body { flex: 1; }

.ach-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.ach-desc {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.ach-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ach-rarity {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ach-xp {
  font-size: 0.75rem;
  color: #f59e0b;
  font-weight: 700;
}

/* ===== COMPLETED LIST ===== */
.completed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.completed-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}

.completed-card:hover { border-color: rgba(124,58,237,0.4); }

.completed-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.completed-body { flex: 1; }

.completed-quiz-name {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.completed-result {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.completed-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag-label {
  font-size: 0.72rem;
  color: var(--accent2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.retry-badge {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  padding: 2px 7px;
  border-radius: 100px;
}

.completed-replay {
  font-size: 0.82rem;
  color: var(--accent2);
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 16px;
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: 100px;
  transition: all 0.2s;
}
.completed-replay:hover {
  background: rgba(168,85,247,0.15);
  border-color: var(--accent2);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  gap: 14px;
  color: var(--muted);
}

.empty-icon { font-size: 3rem; }

.empty-state p { font-size: 1rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  margin: 20px;
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 18px;
}

.modal-input {
  width: 100%;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  color: #fff;
  font-size: 1rem;
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--accent2); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-btn-cancel, .modal-btn-ok {
  border: none;
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-cancel {
  background: rgba(255,255,255,0.07);
  color: var(--muted);
}
.modal-btn-cancel:hover { background: rgba(255,255,255,0.12); }

.modal-btn-ok {
  background: var(--accent);
  color: #fff;
}
.modal-btn-ok:hover { background: var(--accent2); }

/* ===== AVATAR PICKER ===== */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.avatar-option {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.avatar-option:hover {
  border-color: var(--accent2);
  transform: scale(1.1);
}

.avatar-option.selected {
  border-color: var(--accent);
  background: rgba(124,58,237,0.2);
}

/* ===== TOAST (профиль) ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ===== ACH TOAST (страница теста) ===== */
.ach-toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.ach-toast {
  background: var(--bg2);
  border: 1px solid rgba(245,158,11,0.5);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateX(120%);
  transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.ach-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.ach-toast-icon { font-size: 1.8rem; flex-shrink: 0; }

.ach-toast-title {
  font-size: 0.7rem;
  color: #f59e0b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.ach-toast-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.ach-toast-xp {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f59e0b;
  white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .profile-hero { flex-direction: column; align-items: flex-start; }
  .achievements-grid { grid-template-columns: 1fr; }
  .completed-card { flex-wrap: wrap; }
  .completed-replay { width: 100%; text-align: center; }
  .ach-toast { max-width: calc(100vw - 40px); }
}
