/* ════════════════════════════════════════════════════════
   MAP SCREEN
════════════════════════════════════════════════════════ */
#screen-map { background: var(--bg); }

.map-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.map-category-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto 18px;
  padding: 2px 4px;
}
.map-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-tab:hover {
  border-color: var(--teal);
  color: #fff;
  background: rgba(78, 205, 196, 0.15);
}
.map-tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--bg);
  box-shadow: var(--glow-teal);
  font-weight: 900;
}

.map-regions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.region-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.region-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.03));
}
.region-card:hover {
  transform: translateY(-4px);
  border-color: var(--teal);
  box-shadow: var(--glow-teal);
}
.region-card.thematic-card {
  background: linear-gradient(180deg, rgba(26, 53, 40, 0.95) 0%, rgba(17, 40, 32, 0.98) 100%);
  border-color: rgba(247, 201, 72, 0.25);
}
.region-card.thematic-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(247, 201, 72, 0.3);
}
.region-card.locked { opacity: 0.5; cursor: not-allowed; }
.region-card.active-region { border-color: var(--gold); box-shadow: var(--glow-gold); }
.region-card.completed {
  background: linear-gradient(160deg, rgba(16, 78, 50, 0.92) 0%, rgba(13, 46, 33, 0.96) 100%);
  border-color: rgba(34, 197, 94, 0.72);
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.16);
}
.region-card.completed:hover {
  border-color: #4ade80;
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.28);
}
.region-card.uncompleted {
  background: linear-gradient(160deg, rgba(22, 34, 52, 0.92) 0%, rgba(15, 24, 38, 0.96) 100%);
  border-color: rgba(148, 163, 184, 0.35);
}
.region-card.uncompleted:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 26px rgba(247, 201, 72, 0.22);
}
.region-status-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}
.region-status-badge.completed {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.55);
}
.region-status-badge.uncompleted {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.region-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.region-icon { font-size: 2.5rem; }
.region-badge-cat {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-transform: uppercase;
}
.region-name { font-family: var(--font-title); font-size: 1.25rem; font-weight: 800; margin-bottom: 2px; }
.region-subtitle {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}
.region-desc { color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; margin-bottom: 14px; flex: 1; }
.region-progress { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.region-progress-fill { height: 100%; background: var(--teal); border-radius: 3px; transition: width 0.5s; }
.region-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* ════════════════════════════════════════════════════════
   SCREEN HEADER (shared)
════════════════════════════════════════════════════════ */
.screen-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.screen-header h2 {
  flex: 1;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
}
.xp-display {
  font-weight: 900;
  color: var(--gold);
  font-size: 0.95rem;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
  color: #1a0a00;
  font-weight: 900;
  font-family: var(--font-title);
  border-radius: 16px;
  padding: 14px 28px;
  font-size: 1rem;
  letter-spacing: 1px;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 420px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(247,147,30,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-xl { padding: 18px 32px; font-size: 1.15rem; border-radius: 20px; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-family: var(--font);
  border-radius: 14px;
  padding: 12px 24px;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  transition: all 0.2s;
  width: 100%;
  max-width: 420px;
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }

.btn-back {
  background: none;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-back:hover { background: rgba(78,205,196,0.1); }

.btn-icon {
  background: var(--card);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--card-2); color: var(--text); }

/* ════════════════════════════════════════════════════════
   PROGRESS SCREEN
════════════════════════════════════════════════════════ */
.progress-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  text-align: center;
}
.stat-card-value { font-size: 2rem; font-weight: 900; color: var(--gold); }
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.achievements-section h3 {
  font-size: 1.1rem; font-weight: 800;
  margin-bottom: 12px; color: var(--teal);
}
.achievements-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.achievement-badge {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 6px;
}
.achievement-badge.earned {
  border-color: var(--gold);
  background: rgba(247,201,72,0.1);
  color: var(--gold);
}

/* ════════════════════════════════════════════════════════
   FINISH SCREEN
════════════════════════════════════════════════════════ */
#screen-finish {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #0a2e24, #061510);
}
.finish-bg {
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg...%3E%3C/svg%3E") repeat;
  opacity: 0.05;
}
.finish-content {
  position: relative; z-index: 2;
  text-align: center;
  padding: 30px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.finish-trophy { font-size: 5rem; animation: bounceIn 0.6s; filter: drop-shadow(0 0 30px rgba(247,201,72,0.8)); }
.finish-title {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.finish-stats {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
}
.finish-stat {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 20px;
  min-width: 110px;
  text-align: center;
}
.finish-stat-val { font-size: 1.6rem; font-weight: 900; color: var(--gold); }
.finish-stat-label { font-size: 0.78rem; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════
   LOADING
════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
}
.loading-spinner {
  width: 50px; height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text { color: var(--text-muted); font-size: 1rem; }

/* ════════════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  animation: toastIn 0.3s, toastOut 0.3s 2.7s forwards;
  pointer-events: none;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }
.toast.xp      { border-color: var(--gold);  color: var(--gold); font-size: 1.1rem; }

/* ════════════════════════════════════════════════════════
   HOME SECONDARY ACTIONS & MISTAKES BADGE
════════════════════════════════════════════════════════ */
.home-secondary-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 420px;
}
.home-secondary-row > button {
  flex: 1;
  padding: 12px 14px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-mistakes-action {
  border-color: rgba(232, 93, 117, 0.4);
}
.btn-mistakes-action:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-leaderboard-home-action {
  border-color: rgba(247, 201, 72, 0.45);
  background: linear-gradient(180deg, rgba(247, 201, 72, 0.12) 0%, rgba(26, 53, 40, 0.9) 100%);
  color: var(--gold);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.btn-leaderboard-home-action:hover {
  border-color: var(--gold);
  color: #fff;
  background: linear-gradient(180deg, rgba(247, 201, 72, 0.25) 0%, rgba(26, 53, 40, 0.95) 100%);
  box-shadow: 0 0 20px rgba(247, 201, 72, 0.45);
  transform: translateY(-2px);
}
.btn-leaderboard-home-action:active {
  transform: translateY(0);
}

.mistakes-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  font-size: 0.75rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  transition: all 0.2s;
}
.mistakes-badge.has-mistakes {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 10px rgba(232, 93, 117, 0.6);
  animation: pulse 2s infinite;
}

/* ════════════════════════════════════════════════════════
   MISTAKES SCREEN (РАБОТА НАД ОШИБКАМИ)
════════════════════════════════════════════════════════ */
.mistakes-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mistakes-hero {
  background: linear-gradient(135deg, rgba(232, 93, 117, 0.15) 0%, rgba(26, 42, 34, 0.8) 100%);
  border: 1px solid rgba(232, 93, 117, 0.35);
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(10px);
}
.mistakes-hero-icon {
  font-size: 2.4rem;
  flex-shrink: 0;
}
.mistakes-hero-body {
  flex: 1;
}
.mistakes-hero-body h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 6px;
}
.mistakes-hero-body p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.mistakes-counter-pill {
  background: rgba(232, 93, 117, 0.25);
  border: 1px solid var(--red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
}

.mistakes-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.mistakes-controls button {
  flex: 1;
  min-width: 240px;
}
.btn-clear-mistakes {
  max-width: 220px;
  color: var(--text-muted);
}
.btn-clear-mistakes:hover {
  border-color: var(--red);
  color: var(--red);
}

.mistakes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  gap: 14px;
}
.mistakes-empty-icon {
  font-size: 4rem;
}
.mistakes-empty h3 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--gold);
}
.mistakes-empty p {
  color: var(--text-muted);
  max-width: 440px;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mistake-item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: transform 0.2s, border-color 0.2s;
}
.mistake-item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 93, 117, 0.6);
  border-left-color: var(--red);
}

.mistake-item-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 65px;
  text-align: center;
}
.mistake-item-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.mistake-item-name {
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 800;
  line-height: 1.15;
}
.mistake-item-role {
  font-size: 0.62rem;
  color: var(--teal);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.mistake-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mistake-item-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mistake-tag-loc {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--teal);
  background: rgba(78, 205, 196, 0.12);
  padding: 2px 8px;
  border-radius: 8px;
}
.mistake-tag-type {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(247, 147, 30, 0.12);
  padding: 2px 8px;
  border-radius: 8px;
}
.mistake-tag-topic {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 8px;
}
.mistake-item-text {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  line-height: 1.4;
}
.mistake-item-hint {
  font-size: 0.82rem;
  color: #a0b8ac;
  line-height: 1.4;
}

.btn-delete-mistake {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
  align-self: flex-start;
}
.btn-delete-mistake:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(232, 93, 117, 0.15);
  transform: scale(1.1);
}

