/* NAMOA · мини-апп меты MW4
   Палитра снята с фонового изображения: почти чёрный, алый с свечением,
   точечная сетка и техничные засечки. */

:root {
  --bg:        #08080a;
  --bg-soft:   #0e0e12;
  --surface:   #14141a;
  --surface-2: #1b1b23;
  --surface-3: #22222c;
  --line:      #272732;
  --line-soft: #1e1e27;

  --red:        #e8192c;
  --red-bright: #ff3546;
  --red-deep:   #9b0f1d;
  --red-glow:   rgba(232, 25, 44, .38);

  --text:  #f3f3f6;
  --muted: #8b8b97;
  --dim:   #5d5d68;

  --gold:   #f5b342;
  --blue:   #5aa9ff;
  --green:  #43d17a;
  --purple: #a78bfa;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --gap:   12px;
  --pad:   16px;
  --topbar-h: 60px;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
}

body { min-height: 100vh; min-height: 100dvh; }

h1, h2, h3, .font-display {
  font-family: "Chakra Petch", Inter, sans-serif;
  letter-spacing: .02em;
  margin: 0;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; stroke-width: 2; }

/* ─────────────────────────── Приветствие ─────────────────────────── */

.splash {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: var(--bg);
  display: grid;
  align-content: center;
  justify-items: center;
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
}

.splash--out { opacity: 0; transform: scale(1.04); pointer-events: none; }

.splash__bg {
  position: absolute;
  inset: -4%;
  /* Кадрируем крупно: в исходнике сверху свой логотип, снизу имя —
     они спорят с анимированным заголовком, поэтому оставляем только свечение. */
  background: url("../assets/bg.webp") 50% 46%/cover no-repeat;
  transform: scale(1.34);
  animation: bgDrift 14s var(--ease-in-out) infinite alternate;
  filter: saturate(1.05);
}

@keyframes bgDrift {
  from { transform: scale(1.34) translate3d(0, 0, 0); }
  to   { transform: scale(1.44) translate3d(0, -1.5%, 0); }
}

/* Точечная сетка, как на исходной картинке */
.splash__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .35;
  mix-blend-mode: overlay;
}

.splash__sparks { position: absolute; inset: 0; width: 100%; height: 100%; }

.splash__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 45%, transparent 35%, rgba(0, 0, 0, .55) 100%),
    /* Низ гасим почти в чёрный: в исходнике там подпись, которой в приветствии не место */
    linear-gradient(180deg, rgba(0, 0, 0, .6), transparent 28%,
                    rgba(0, 0, 0, .94) 86%, var(--bg) 100%);
}

.splash__marks { position: absolute; inset: 0; pointer-events: none; }

.mark {
  position: absolute;
  width: 26px;
  height: 26px;
  opacity: 0;
  animation: markIn .5s var(--ease-out) .25s forwards;
}

.mark::before, .mark::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, .5);
}

.mark::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.mark::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }

.mark--tl { top: calc(28px + var(--safe-top)); left: 24px; }
.mark--br { bottom: calc(28px + var(--safe-bottom)); right: 24px; }

@keyframes markIn { to { opacity: 1; } }

.splash__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
}

.splash__title {
  display: flex;
  justify-content: center;
  gap: clamp(2px, 1.2vw, 8px);
  margin: 14px 0 0;
  font-size: clamp(52px, 17vw, 96px);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1;
}

.splash__title .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(26px) rotateX(55deg);
  transform-origin: 50% 100%;
  color: #fff;
  text-shadow:
    0 0 14px rgba(255, 53, 70, .55),
    0 0 42px rgba(232, 25, 44, .45);
  animation: charIn .62s var(--ease-out) forwards;
}

@keyframes charIn {
  60%  { opacity: 1; transform: translateY(-4px) rotateX(-6deg); }
  100% { opacity: 1; transform: translateY(0) rotateX(0); }
}

/* Пробег блика по названию */
.splash__title::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash__rule {
  width: 0;
  height: 2px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
  box-shadow: 0 0 18px var(--red-glow);
  animation: ruleGrow .8s var(--ease-out) .75s forwards;
}

@keyframes ruleGrow { to { width: min(260px, 70vw); } }

.splash__sub {
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transform: translateY(10px);
  animation: riseIn .7s var(--ease-out) .95s forwards;
}

@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }

/* ─────────────────────────── Каркас приложения ─────────────────────────── */

.app { display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: calc(10px + var(--safe-top)) var(--pad) 10px;
  min-height: var(--topbar-h);
  background: linear-gradient(180deg, rgba(8, 8, 10, .96), rgba(8, 8, 10, .82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: .55;
}

.topbar__channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-md);
  transition: background .2s var(--ease-out), transform .12s var(--ease-out);
}

.topbar__channel:active { transform: scale(.97); background: var(--surface-2); }

.topbar__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #9146ff, #6d29d9);
  color: #fff;
  font-size: 19px;
  box-shadow: 0 6px 18px rgba(145, 70, 255, .35);
}

.topbar__names { display: flex; flex-direction: column; line-height: 1.15; }

.topbar__nick {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .04em;
}

.topbar__hint { font-size: 11px; color: var(--dim); letter-spacing: .06em; }

.topbar__live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 0 0 var(--red-glow);
  animation: pulse 2.4s var(--ease-in-out) infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 53, 70, .5); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 53, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 53, 70, 0); }
}

/* Кнопка розыгрыша: единственный элемент интерфейса, которому позволено зазывать */
.promo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 9px;
  border-radius: var(--r-md);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #e8192c 0%, #ff4d2e 45%, #ff8a3d 100%);
  box-shadow: 0 6px 16px rgba(232, 25, 44, .3);
  animation: promoBreath 3.4s var(--ease-in-out) infinite;
}

@keyframes promoBreath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

.promo:active { transform: scale(.96); animation: none; }

/* Блик пробегает раз в несколько секунд — движение ловит взгляд лучше статичной заливки */
.promo__shine {
  position: absolute;
  top: -60%;
  left: -70%;
  width: 45%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(18deg);
  animation: promoShine 3.4s var(--ease-in-out) infinite;
}

@keyframes promoShine {
  0%, 55%  { left: -70%; }
  85%, 100% { left: 130%; }
}

.promo__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 15px;
  background: rgba(255, 255, 255, .18);
}

.promo__text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }

.promo__title {
  font-family: "Chakra Petch", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.promo__sub { font-size: 10px; letter-spacing: .08em; opacity: .85; }

/* ─────────────────────────── Содержимое ─────────────────────────── */

.content {
  flex: 1;
  padding: 4px var(--pad) calc(32px + var(--safe-bottom));
}

.list { display: flex; flex-direction: column; gap: var(--gap); }

.list--swap { animation: swapIn .34s var(--ease-out); }

@keyframes swapIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────── Фильтры по классу ─────────────────────────── */

.filters {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top));
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 12px var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(180deg, rgba(8, 8, 10, .96) 65%, rgba(8, 8, 10, 0));
}

.filters::-webkit-scrollbar { display: none; }

.chip {
  position: relative;
  flex: none;
  width: 86px;
  padding: 6px 4px 16px;
  display: grid;
  /* Строка под подпись держится всегда: иначе при выборе картинки поедут вниз */
  grid-template-rows: 14px auto;
  justify-items: center;
  background: none;
  border: 0;
  opacity: 1;
  transition: opacity .3s var(--ease-out);
}

.chip__label {
  font-family: "Chakra Petch", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--red-bright);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .28s var(--ease-out), transform .28s var(--ease-out);
}

.chip--on .chip__label { opacity: 1; transform: translateY(0); }

.filters--picked .chip:not(.chip--on) { opacity: .38; }

.chip__img {
  width: 80px;
  height: 44px;
  object-fit: contain;
  /* Тень кладётся на контур картинки, а не на блок — отсюда drop-shadow, а не box-shadow */
  filter: drop-shadow(0 7px 8px rgba(0, 0, 0, .8)) saturate(.85) brightness(.82);
  transform: translateY(0);
  transition: filter .3s var(--ease-out), transform .3s var(--ease-out);
}

/* Подсветка снизу — оружие будто стоит на подсвеченном стенде */
.chip__stand {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 62px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
              color-mix(in srgb, var(--red-bright) 70%, transparent), transparent 70%);
  filter: blur(4px);
  opacity: .28;
  transition: opacity .3s var(--ease-out), width .3s var(--ease-out),
              height .3s var(--ease-out);
}

.chip__stand::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 1px;
  transform: translate(-50%, -50%);
  background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
  opacity: .5;
}

.chip:active .chip__img { transform: translateY(1px) scale(.97); }

.chip--on .chip__img {
  filter: drop-shadow(0 0 9px color-mix(in srgb, var(--red-bright) 65%, transparent))
          drop-shadow(0 9px 10px rgba(0, 0, 0, .85))
          saturate(1.1) brightness(1.18);
  transform: translateY(-4px) scale(1.07);
}

.chip--on .chip__stand { opacity: 1; width: 74px; height: 16px; }


/* ─────────────────────────── Карточка оружия ─────────────────────────── */

.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  overflow: hidden;
}



.card__tier {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 11px 4px;
  border-radius: 0 0 var(--r-md) 0;
  background: var(--tier-color, var(--red));
  color: #0d0d12;
  font-family: "Chakra Petch", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.card__head {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  /* сверху место под лейбл тира, снизу — под прижатую классификацию */
  padding: 22px 14px 30px;
  text-align: left;
}



.card__thumb {
  position: relative;
  height: 54px;
  display: grid;
  place-items: center;
}

.card__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  /* Рендеры оружия тёмные — слегка поднимаем контраст, чтобы читались на фоне карточки */
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .7)) brightness(1.12) contrast(1.06);
}

.card__info { min-width: 0; }

.card__name {
  width: 100%;
  font-family: "Chakra Petch", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank {
  /* Классификация прижата к нижней кромке карточки и не зависит от длины названия */
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 28px);
  padding: 4px 18px 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: #12121a;
  background: var(--rank-color, var(--gold));
  /* Срезанные бока: трапеция, расширяющаяся к низу карточки */
  clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 100%, 0 100%);
  white-space: nowrap;
}

.rank__num { font-family: "Chakra Petch", sans-serif; font-weight: 700; }



.card--quiet { opacity: .55; }

.card__chev { opacity: .4; }

.card__chev {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  font-size: 18px;
  color: var(--dim);
  transition: color .2s var(--ease-out), transform .2s var(--ease-out);
}



.card__side { display: flex; align-items: center; gap: 8px; flex: none; color: var(--muted); }

.card__count {
  font-size: 10px;
  letter-spacing: .06em;
  white-space: nowrap;
  color: var(--dim);
}

.card--quiet { opacity: .55; }
.card--quiet .card__chev { opacity: .4; }

.card__chev { transform: rotate(180deg); color: var(--tier-color, var(--red-bright)); }

/* Плавное раскрытие без замеров высоты */
/* ─────────────────────────── Модальное окно сборки ─────────────────────────── */

.sheet { position: fixed; inset: 0; z-index: 70; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .34s var(--ease-out);
}

.sheet--in .sheet__backdrop { opacity: 1; }

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding: 8px var(--pad) calc(18px + var(--safe-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--bg-soft) 42%);
  transform: translateY(100%);
  transition: transform .42s var(--ease-out);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .6);
}

.sheet--in .sheet__panel { transform: translateY(0); }

.sheet__panel::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--style-color, var(--red)), transparent);
}

.sheet__handle {
  width: 42px;
  height: 4px;
  margin: 4px auto 10px;
  border-radius: 999px;
  background: var(--surface-3);
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}

.sheet__titles { min-width: 0; }

.sheet__weapon {
  display: block;
  font-family: "Chakra Petch", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.sheet__style {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--style-color, var(--gold));
}

.sheet__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 17px;
  flex: none;
}

.sheet__close:active { transform: scale(.94); }

/* Высота задаётся пропорцией рендера (1366x409), поэтому место под картинку
   занято ещё до её загрузки: каркас окна не меняется и ничего не подпрыгивает. */
.sheet__hero {
  position: relative;
  margin: 12px 10px 0;
  aspect-ratio: 1366 / 409;
  flex: none;
}

.sheet__hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .25s var(--ease-out);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .75)) brightness(1.06);
}

.sheet__hero--ready img { opacity: 1; }

.sheet__hero::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--red-bright);
  animation: spin .8s linear infinite;
  opacity: 1;
  transition: opacity .2s var(--ease-out);
}

.sheet__hero--ready::after { opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }

.switch {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  /* Без этого запас высоты у списка модулей сжимал переключатель, и кнопки обрезались */
  flex: none;
}

.switch::-webkit-scrollbar { display: none; }

.top {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: "Chakra Petch", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  transition: color .24s var(--ease-out), background .24s var(--ease-out),
              border-color .24s var(--ease-out), transform .2s var(--ease-out);
}

.top:active { transform: scale(.96); }

.top--on {
  color: #12121a;
  background: var(--top-color, var(--gold));
  border-color: transparent;
}

.top__crown { font-size: 13px; }

.sheet__body {
  margin-top: 14px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

/* Появление строк модуля. Раньше эти кадры жили в блоке сборок внутри карточки —
   вместе с ним они и уехали, оставив .att с нулевой прозрачностью. */
@keyframes buildIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.att {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  opacity: 0;
  animation: buildIn .3s var(--ease-out) forwards;
}

.att__num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--dim);
  font-family: "Chakra Petch", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.att__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

.att__slot {
  margin-top: 3px;
  display: inline-block;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--blue);
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(90, 169, 255, .12);
}

.att__lvl {
  font-family: "Chakra Petch", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.sheet__note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}

/* ─────────────────────────── Служебное ─────────────────────────── */

/* display в правиле ниже перебивает атрибут hidden — возвращаем ему силу */
[hidden] { display: none !important; }

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 0;
  color: var(--dim);
  font-size: 14px;
}

.empty i { font-size: 28px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
