/* ═══════════════════════════════════════════════════════════════
   Вся палитра здесь. Захочешь перекрасить под ваш вайб —
   меняешь эти переменные, остальное подхватится само.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0a0b0f;
  --bg-2:        #12141c;
  --bg-3:        #1a1d28;
  --panel:       #151824;
  --line:        #242838;

  --text:        #e8eaf0;
  --text-dim:    #8b90a5;
  --text-faint:  #565b70;

  --accent:      #00e57a;   /* основной неон */
  --accent-dim:  #00a856;
  --danger:      #ff3b57;
  --gold:        #ffc23d;

  /* редкости — как в CS */
  --r-consumer:   #b0c3d9;
  --r-industrial: #5e98d9;
  --r-milspec:    #4b69ff;
  --r-restricted: #8847ff;
  --r-classified: #d32ce6;
  --r-covert:     #eb4b4b;
  --r-knife:      #ffd700;

  /* Дисплейный — заголовки, логотип, кнопки-ставки. Текстовый — всё
     читаемое. Моно — терминал, цифры, баланс. */
  --font-display: 'Chakra Petch', 'Manrope', system-ui, sans-serif;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Courier New', monospace;

  --radius: 10px;
  --header-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow-x: hidden; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input  { font-family: inherit; }
img    { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #000; }

/* ── скроллбар ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

/* ═══════════════════════════════════════════════════════════════
   КАРКАС
   ═══════════════════════════════════════════════════════════════ */

#app { min-height: 100dvh; position: relative; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: fadeIn .5s ease both;
}

.screen--center {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.fade-out { animation: fadeOut .45s ease both; }
@keyframes fadeOut { to { opacity: 0 } }

/* ═══════════════════════════════════════════════════════════════
   АКТ 1 — ЗАСТАВКА
   ═══════════════════════════════════════════════════════════════ */

.intro {
  background: var(--bg);
  font-family: var(--mono);
}

.intro__lines {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 15px;
  letter-spacing: .04em;
}

.intro__line::before { content: '> '; color: var(--text-faint); }

.intro__line--typing::after {
  content: '▊';
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0 } }

.intro__btn {
  margin-top: 48px;
  padding: 20px 44px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .18em;
  color: #000;
  background: var(--accent);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(10px);
  animation: riseIn .7s ease .3s both;
  box-shadow: 0 0 0 0 rgba(0, 229, 122, .5);
  transition: box-shadow .3s, transform .15s;
}

.intro__btn:hover { transform: translateY(-2px); box-shadow: 0 0 40px 0 rgba(0, 229, 122, .45); }
.intro__btn:active { transform: translateY(0); }

@keyframes riseIn { to { opacity: 1; transform: translateY(0) } }

.intro__hint {
  margin-top: 20px;
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: .1em;
  opacity: 0;
  animation: riseIn .7s ease 1s both;
}

/* ═══════════════════════════════════════════════════════════════
   АКТ 2 — ВИДЕО
   ═══════════════════════════════════════════════════════════════ */

.video-act { background: #000; align-items: center; justify-content: center; padding: 0; }
.video-act video { width: 100%; height: 100dvh; object-fit: contain; background: #000; }

.video-act__skip {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 40px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  opacity: 0;
  animation: riseIn .5s ease both;
}

.video-act__after {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: .1em;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   АКТ 3 — КВИЗ
   ═══════════════════════════════════════════════════════════════ */

.quiz { padding: 40px 24px; align-items: center; justify-content: center; }
.quiz__inner { width: 100%; max-width: 620px; }

.quiz__title {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--accent);
  text-align: center;
}

.quiz__subtitle {
  margin-top: 8px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}

/* полоска собранных букв */
.letters {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 36px 0;
  flex-wrap: wrap;
}

.letter {
  width: 46px;
  height: 56px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text-faint);
  transition: all .3s;
}

.letter--filled {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 229, 122, .08);
  box-shadow: 0 0 24px rgba(0, 229, 122, .2);
}

/* Перелёт живёт в самих кадрах, а тайминг — ровное затухание.
   Так «хлопок» остаётся, но без резинового отскока. */
.letter--just-won { animation: letterPop .55s cubic-bezier(.22, 1, .36, 1) both; }

@keyframes letterPop {
  0%   { transform: scale(1) }
  35%  { transform: scale(1.32) rotate(-3deg) }
  100% { transform: scale(1) }
}

.question {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
}

.question__num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--text-faint);
}

.question__text {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
}

.question__options { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }

.option {
  padding: 15px 18px;
  text-align: left;
  font-size: 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all .15s;
}

.option:hover { border-color: var(--accent-dim); background: var(--bg-3); }
.option--wrong { border-color: var(--danger); animation: shake .4s; }
.option--right { border-color: var(--accent); background: rgba(0, 229, 122, .1); }

@keyframes shake {
  0%,100% { transform: translateX(0) }
  25% { transform: translateX(-8px) }
  75% { transform: translateX(8px) }
}

.question__input {
  margin-top: 24px;
  display: flex;
  gap: 10px;
}

.question__input input {
  flex: 1;
  padding: 15px 18px;
  font-size: 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}

.question__input input:focus { border-color: var(--accent-dim); }

.btn-primary {
  padding: 15px 28px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .06em;
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  transition: transform .12s, filter .2s;
}

.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.question__feedback {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

/* ═══════════════════════════════════════════════════════════════
   ОБЩЕЕ ДЛЯ ПРЕДМЕТОВ
   ═══════════════════════════════════════════════════════════════ */

.item {
  position: relative;
  background: var(--bg-2);
  border-radius: 8px;
  overflow: hidden;
  color: var(--r-consumer);
}

/* Полоска редкости — псевдоэлемент, а не border: так она не спорит
   со скруглением углов и обрезается ровно по радиусу карточки. */
.item::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: currentColor;
}

.item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 120%, currentColor 0%, transparent 65%);
  opacity: .16;
  pointer-events: none;
}

.item[data-rarity="consumer"]   { color: var(--r-consumer) }
.item[data-rarity="industrial"] { color: var(--r-industrial) }
.item[data-rarity="milspec"]    { color: var(--r-milspec) }
.item[data-rarity="restricted"] { color: var(--r-restricted) }
.item[data-rarity="classified"] { color: var(--r-classified) }
.item[data-rarity="covert"]     { color: var(--r-covert) }
.item[data-rarity="knife"]      { color: var(--r-knife) }

.item__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-3);
}

/* ── титулы: карточка вместо картинки ──────────────────────── */
.item__title {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 14px;
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.028) 0 2px, transparent 2px 7px),
    var(--bg-3);
}

/* Длинные титулы вроде «ДаркнессНикитка» должны переноситься,
   а не обрезаться многоточием. */
.item__title span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(12px, 1.7vw, 17px);
  line-height: 1.12;
  text-align: center;
  color: currentColor;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-shadow: 0 0 24px currentColor;
}

/* В названии под карточкой тоже не режем, а переносим */
.item--title .item__name {
  white-space: normal;
  line-height: 1.25;
}

.item--title .item__name { color: var(--text-faint) }

/* трек без обложки — то же, но со значком ноты фоном */
.item__title--music::after {
  content: '♪';
  position: absolute;
  right: 10px;
  bottom: 4px;
  font-size: 46px;
  line-height: 1;
  color: currentColor;
  opacity: .13;
  pointer-events: none;
}

/* эмодзи во всю карточку */
.item__emoji {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: clamp(46px, 9vw, 82px);
  line-height: 1;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.05), transparent 65%),
    var(--bg-3);
}

/* значок трека */
.item__note {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 11, 15, .72);
  backdrop-filter: blur(6px);
  color: currentColor;
  font-size: 13px;
  z-index: 2;
}

.item__body { padding: 10px; position: relative; }
.item__name { font-size: 12px; color: var(--text-dim); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__wear {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--danger);
  opacity: .8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__price { margin-top: 4px; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   УТИЛИТЫ
   ═══════════════════════════════════════════════════════════════ */

.mono { font-family: var(--mono); }
.dim  { color: var(--text-dim); }
.faint{ color: var(--text-faint); }
.accent { color: var(--accent); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ── панель режима отладки ─────────────────────────────────── */
/* Намеренно заметная. Пока она на экране — сайт не готов к запуску. */
.devbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: #16070c;
  box-shadow: 0 -6px 26px rgba(255, 59, 87, .3), inset 0 2px 0 var(--danger);
}

.devbar__warn {
  flex: 1 1 auto;
  min-width: 190px;
  padding: 5px 10px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2a0008;
  background: repeating-linear-gradient(45deg, var(--danger) 0 12px, #ff6b7f 12px 24px);
}

.devbar__jumps { display: flex; gap: 5px; flex-wrap: wrap }

.devbar__btn {
  padding: 6px 11px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
  color: var(--text-dim);
  background: #2a1218;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.devbar__btn:hover { background: var(--danger); color: #fff }
.devbar__btn--here { color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger) }

/* чтобы панель не перекрывала нижние элементы */
body:has(.devbar) .cbody { padding-bottom: 130px }
body:has(.devbar) .support-btn { bottom: 74px }
body:has(.devbar) .support-panel { bottom: 138px }
body:has(.devbar) .toast-layer { bottom: 82px }
body:has(.devbar) .heart-screen,
body:has(.devbar) .finale-screen { padding-bottom: 80px }

/* ── конфетти ──────────────────────────────────────────────── */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  display: block;
  will-change: transform, opacity;
  animation-name: confettiFly;
  animation-timing-function: cubic-bezier(.18, .7, .38, 1);
  animation-fill-mode: both;
}

@keyframes confettiFly {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1 }
  70%  { opacity: 1 }
  100% {
    transform: translate3d(var(--dx), calc(var(--dy) + 60vh), 0) rotate(var(--rot));
    opacity: 0;
  }
}

.toast-layer {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 12px 22px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 30px;
  font-size: 14px;
  animation: toastIn .3s ease both;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.toast--good { border-color: var(--accent-dim); color: var(--accent); }
.toast--bad  { border-color: var(--danger); color: var(--danger); }

@keyframes toastIn { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
