/* =========================================================
   FortniteHelper — єдиний файл стилів
   Структура: токени → база → компоненти → сторінки → адаптив
   ========================================================= */

/* ---------- Токени ---------- */
:root {
  color-scheme: dark;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #0d0a16;
  --bg-elevated: #151021;
  --surface: #1b1530;
  --surface-2: #261d44;
  --border: rgb(255 255 255 / 0.09);

  --text: #f5f2fc;
  --muted: #a99fc7;

  --brand: #8b5cf6;
  --brand-deep: #362159;
  --accent: #d6e23a;
  --accent-ink: #14120a;
  --danger: #ff6b81;

  --rarity: var(--brand);

  --radius: 18px;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  --container: 1200px;
}

/* ---------- База ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--font);
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -8%, rgb(139 92 246 / 0.24), transparent 62%),
    radial-gradient(700px 480px at 100% 0%, rgb(214 226 58 / 0.07), transparent 60%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

ul {
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(13 10 22 / 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(140%);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #4c1d95);
  box-shadow: 0 4px 14px rgb(139 92 246 / 0.45);
  color: var(--accent);
  font-weight: 800;
}

.main-nav {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: rgb(255 255 255 / 0.06);
}

.nav-link[aria-current='page'] {
  color: var(--text);
  background: rgb(139 92 246 / 0.24);
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-user {
  max-width: 140px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 20px rgb(214 226 58 / 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgb(214 226 58 / 0.34);
}

.btn-ghost {
  background: rgb(255 255 255 / 0.04);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.09);
  border-color: rgb(255 255 255 / 0.22);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.9rem;
}

.btn-lg {
  padding: 14px 30px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

/* ---------- Картка, поля, мітки ---------- */
.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.045), rgb(255 255 255 / 0.015)), var(--surface);
  box-shadow: var(--shadow);
}

.input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input::placeholder {
  color: #7d739a;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(139 92 246 / 0.3);
}

select.input {
  padding-right: 38px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a99fc7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
}

.search-field {
  position: relative;
  display: block;
}

.search-field .input {
  padding-left: 44px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge {
  background: rgb(214 226 58 / 0.14);
  color: var(--accent);
}

.tag {
  border: 1px solid var(--rarity);
  color: var(--rarity);
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 16px;
  color: var(--muted);
  text-align: center;
}

.state.is-error {
  color: var(--danger);
}

.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Заголовки сторінок ---------- */
.page {
  padding-top: 48px;
  padding-bottom: 80px;
}

.page-head {
  margin-bottom: 28px;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-lead {
  margin-top: 8px;
  color: var(--muted);
}

/* ---------- Головна ---------- */
.hero {
  display: grid;
  place-items: center;
  min-height: min(78vh, 760px);
  padding: 96px 24px 120px;
  text-align: center;
  background:
    linear-gradient(180deg, rgb(13 10 22 / 0.5), rgb(13 10 22 / 0.78) 70%, var(--bg)),
    radial-gradient(700px 400px at 50% 40%, rgb(139 92 246 / 0.35), transparent 70%),
    url(../src/images/hero.jpg) center / cover no-repeat;
}

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.06);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hero-title span {
  background: linear-gradient(90deg, #e6f04f, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 560px;
  margin: 20px auto 0;
  color: #d4cde8;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
}

.features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: -64px;
  padding-bottom: 96px;
}

.feature {
  display: block;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s;
}

.feature:hover {
  transform: translateY(-4px);
  border-color: rgb(139 92 246 / 0.6);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgb(139 92 246 / 0.2);
  color: var(--accent);
}

.feature-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.feature-text {
  margin-top: 6px;
  color: var(--muted);
}

/* ---------- Косметика ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.toolbar .search-field {
  flex: 1 1 280px;
  max-width: 420px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-body {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.04);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.chip:hover .chip-body {
  color: var(--text);
  border-color: rgb(255 255 255 / 0.22);
}

.chip input:checked + .chip-body {
  border-color: var(--brand);
  background: rgb(139 92 246 / 0.24);
  color: var(--text);
}

.chip input:focus-visible + .chip-body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-position: center;
  background-size: cover;
}

.thumb-all {
  background-image: url(../src/images/all.jpg);
}

.thumb-br {
  background-image: url(../src/images/br.jpg);
}

.thumb-lego {
  background-image: url(../src/images/lego.jpg);
}

.thumb-race {
  background-image: url(../src/images/racing.jpg);
}

.thumb-festival {
  background-image: url(../src/images/festival.jpg);
}

.results-meta {
  min-height: 1.5em;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.cosmetic-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cosmetic-card:not(.skeleton)::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 3px;
  background: var(--rarity);
  pointer-events: none;
}

.cosmetic-card:not(.skeleton):hover {
  transform: translateY(-4px);
  border-color: var(--rarity);
  box-shadow: 0 14px 28px -10px var(--rarity);
}

.cosmetic-card-btn {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rarity) 38%, transparent), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--bg-elevated));
  text-align: left;
}

.cosmetic-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cosmetic-card-name {
  position: absolute;
  inset: auto 0 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  padding: 28px 10px 12px;
  background: linear-gradient(to top, rgb(8 5 16 / 0.92), transparent);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* Кольори рідкості: значення беруться з data-rarity у вигляді slug (див. cosmetics.js) */
[data-rarity='common'] { --rarity: #b4b4b4; }
[data-rarity='uncommon'] { --rarity: #5fb83e; }
[data-rarity='rare'] { --rarity: #3ea8f0; }
[data-rarity='epic'] { --rarity: #b25be6; }
[data-rarity='legendary'] { --rarity: #f0913b; }
[data-rarity='mythic'] { --rarity: #f2d65a; }
[data-rarity='exotic'] { --rarity: #7ff0f0; }
[data-rarity='transcendent'] { --rarity: #ff7ad9; }
[data-rarity^='icon'] { --rarity: #34e1e5; }
[data-rarity^='marvel'] { --rarity: #ee2d3a; }
[data-rarity^='dc'] { --rarity: #5a8fe0; }
[data-rarity^='star-wars'] { --rarity: #e8c230; }
[data-rarity^='gaming'] { --rarity: #8a4ee8; }
[data-rarity^='lava'] { --rarity: #f0782b; }
[data-rarity^='frozen'] { --rarity: #8ad7ff; }
[data-rarity^='shadow'] { --rarity: #8b8b99; }
[data-rarity^='slurp'] { --rarity: #22d3ee; }

/* Модальне вікно */
.cosmetic-modal {
  width: min(780px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto; /* глобальний скидання margin прибирає центрування <dialog> */
  padding: 0;
  overflow: auto;
  border: 1px solid var(--rarity);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6), 0 0 60px -20px var(--rarity);
}

.cosmetic-modal::backdrop {
  background: rgb(8 5 16 / 0.78);
  backdrop-filter: blur(6px);
}

body:has(dialog[open]) {
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgb(13 10 22 / 0.7);
  font-size: 1.4rem;
  line-height: 1;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background: rgb(255 255 255 / 0.14);
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
}

.modal-media {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rarity) 40%, transparent), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--bg-elevated));
}

.modal-img {
  width: 100%;
  border-radius: 14px;
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 28px;
}

.modal-kind {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-text {
  color: #d4cde8;
}

.modal-meta {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.modal-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.modal-meta dt {
  color: var(--muted);
}

.modal-meta dd {
  font-weight: 600;
  text-align: right;
}

/* ---------- Статистика ---------- */
.stats-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px auto;
  gap: 12px;
  margin-bottom: 32px;
}

.player-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), #4c1d95);
  box-shadow: 0 8px 24px rgb(139 92 246 / 0.4);
  font-size: 2rem;
  font-weight: 800;
}

.player-info {
  min-width: 0;
}

.player-name {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.player-meta {
  margin-top: 6px;
  color: var(--muted);
}

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}

.tab {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: background-color 0.2s, color 0.2s;
}

.tab:hover:not(:disabled) {
  color: var(--text);
}

.tab[aria-selected='true'] {
  background: var(--brand);
  color: #fff;
}

.tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stat-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* --cols задає stats.js за кількістю показників у картці (2 або 3) */
.stat-group {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
}

.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.stat-value.is-accent {
  color: var(--accent);
}

/* ---------- Карта ---------- */
.map-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.map-panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 16px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
}

.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #40375d;
  transition: background-color 0.2s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s, background-color 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  background: var(--accent-ink);
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.map-viewport {
  position: relative;
  width: 100%;
  height: clamp(360px, calc(100dvh - 250px), 900px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0814;
  box-shadow: var(--shadow);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.map-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.icon-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgb(13 10 22 / 0.8);
  font-size: 1.1rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  transition: background-color 0.2s;
}

.icon-btn:hover {
  background: rgb(255 255 255 / 0.14);
}

.map-state {
  position: absolute;
  inset: 0;
  z-index: 1;
  justify-content: center;
  background: rgb(10 8 20 / 0.7);
}

/* ---------- Вхід / реєстрація ---------- */
.auth-page {
  display: grid;
  place-items: start center;
  padding: 64px 16px 96px;
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 32px;
}

.auth-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-status {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgb(255 107 129 / 0.12);
  color: var(--danger);
  font-size: 0.92rem;
}

.auth-alt {
  color: var(--muted);
  text-align: center;
}

.auth-alt a {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Підвал ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 24px;
  padding-bottom: 24px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-panel {
    position: static;
  }

  .stats-form {
    grid-template-columns: 1fr 1fr;
  }

  .stats-form .grow,
  .stats-form .btn {
    grid-column: 1 / -1;
  }

  .tabs {
    width: 100%;
    margin-left: 0;
  }

  .tab {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .stat-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header-inner {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 10px 16px;
  }

  .brand {
    margin-right: auto;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin: 0;
    overflow-x: auto;
  }

  .container {
    padding: 0 16px;
  }

  .page {
    padding-top: 32px;
  }

  .cosmetic-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-media {
    padding: 24px 24px 8px;
  }

  .modal-img {
    max-width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
