/* ---------- Капсулы-награды: «Выпала капсула!», пул наград в линию, тряска, взрыв в дыму, награда на сиянии ---------- */
.caps-overlay {
  position: fixed; inset: 0; z-index: 720; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(58,26,110,.88), rgba(6,4,14,.95));
}
.caps-box {
  --rc: #c9a7ff;
  width: min(880px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; overflow-x: hidden; text-align: center;
  display: flex; flex-direction: column; align-items: center; animation: lootIn .45s cubic-bezier(.2,1.4,.4,1);
  scrollbar-width: none; /* на низких экранах прокручивается, но полоса не мелькает */
}
.caps-box::-webkit-scrollbar { display: none; }
.caps-title.caps-empty { visibility: hidden; }
.caps-title { font-family: var(--font-display); font-size: 38px; letter-spacing: 2px; text-transform: uppercase; color: #fff; text-shadow: 0 0 24px var(--rc), 0 3px 0 rgba(0,0,0,.4); }
.caps-title.caps-title-rarity { color: var(--rc); text-shadow: 0 0 22px color-mix(in srgb, var(--rc) 70%, transparent), 0 3px 0 rgba(0,0,0,.45); }
.caps-sub { color: #c8ccd8; margin-top: 2px; font-size: 14px; min-height: 18px; }

/* что может выпасть — в линию над капсулой, как игроки на заставке рейтинга */
/* ряд стоит прямо над сундуком: заходит на верх сцены (там пусто, пока награда не поднялась) */
.caps-line { position: relative; z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px; margin: 16px 0 -205px; max-width: 100%; transition: opacity .3s; }
.caps-line.caps-fade { opacity: 0; pointer-events: none; }
.caps-drop { width: 112px; cursor: help; display: flex; flex-direction: column; align-items: center; animation: capsDropIn .45s cubic-bezier(.2,1.5,.4,1) backwards; }
@keyframes capsDropIn { from { transform: translateY(-16px) scale(.6); opacity: 0; } }
.caps-drop-art {
  position: relative; width: 100px; height: 100px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 42%, transparent), transparent 70%);
}
.caps-drop b { font-size: 14px; color: #fff; line-height: 1.15; margin-top: 3px; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caps-drop small { font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--rc); max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* просмотр предмета при наведении: персонаж бежит со своим следом */
.caps-pop {
  --rc: #c9a7ff;
  position: fixed; z-index: 730; width: 280px; padding: 10px 10px 12px; border-radius: 12px; text-align: center; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 22%, #151a2b), #10131f); border: 1px solid color-mix(in srgb, var(--rc) 60%, transparent);
  box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 24px color-mix(in srgb, var(--rc) 35%, transparent); animation: fxPopIn .14s ease-out;
}
.caps-pop-stage { display: block; margin: 0 auto 6px; border-radius: 8px; }
.caps-pop b { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1.15; color: #fff; }
.caps-pop-r { font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--rc); }
/* у героев — свой след: молния и название */
/* светлый текст с тёмной тенью — читается на фоне любой редкости; молния золотая */

/* праздник редкой награды: частицы на весь экран; «Ударная волна» встряхивает окно */
.caps-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.caps-quake { animation: capsQuake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes capsQuake {
  10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -3px); }
  30%, 50%, 70% { transform: translate(-8px, 4px); } 40%, 60% { transform: translate(8px, -4px); }
}

/* фон окна капсулы — 5 вариантов (выбор на /lab/capsule-open.html); все непрозрачные: инвентарь не просвечивает */
/* затемнение поверх игры: видно меню/инвентарь, но приглушённо и чуть размыто (как в мобильных играх) */
/* меню заметно размыто и притушено, а за капсулой и пулом — тёмное пятно, чтобы они не сливались с клетками инвентаря */
.caps-overlay.bg-dim {
  background: radial-gradient(ellipse 46% 42% at 50% 50%, rgba(8,6,16,.9), rgba(8,6,16,.55) 75%, transparent),
              radial-gradient(circle at 50% 55%, rgba(10,8,18,.78), rgba(4,3,8,.93) 75%);
  backdrop-filter: blur(24px) saturate(.5); -webkit-backdrop-filter: blur(24px) saturate(.5);
}
.caps-overlay.bg-night { background: radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1.5px 1.5px at 78% 12%, #fff, transparent), radial-gradient(1px 1px at 64% 72%, #cfe3ff, transparent), radial-gradient(1.5px 1.5px at 30% 82%, #fff, transparent), radial-gradient(1px 1px at 90% 58%, #fff, transparent), radial-gradient(circle at 50% 55%, #14214d, #050815 70%); }
.caps-overlay.bg-rays { background: repeating-conic-gradient(from 0deg at 50% 58%, rgba(255,255,255,.05) 0 9deg, transparent 9deg 18deg), radial-gradient(circle at 50% 58%, #127a9c, #062636 72%); }
.caps-overlay.bg-velvet { background: radial-gradient(ellipse 40% 26% at 50% 66%, rgba(255,240,210,.12), transparent 70%), radial-gradient(circle at 50% 40%, #191622, #050407 75%); }
.caps-overlay.bg-teal { background: linear-gradient(180deg, #0d5363, #062a33 55%, #03141a); }
.caps-overlay.bg-gold { background: radial-gradient(circle at 50% 55%, #4a2c0a, #120a03 72%); }

/* то, что уже есть, — чёрно-белое, подписи серые */
.caps-drop.have .caps-drop-art { filter: grayscale(1) brightness(.75); }
.caps-drop.have b, .caps-drop.have small { color: #8a8698; }
.caps-stage { display: block; margin: 0 auto; }
.caps-info { min-height: 0; opacity: 0; transform: translateY(8px); transition: opacity .4s .15s, transform .4s .15s; }
.caps-info.show { opacity: 1; transform: none; }
/* сцена и подпись награды поверх её низа — высота окна не меняется, ничего не дёргается */
.caps-box { min-width: 0; } /* иначе широкая сцена растягивает окно шире экрана телефона */
.caps-stage-wrap { position: relative; width: 100%; min-width: 0; overflow: hidden; display: flex; justify-content: center; } /* на узком экране сцена обрезается по бокам поровну */
.caps-stage-wrap .caps-stage { flex: none; }
.caps-info { position: absolute; left: 0; right: 0; pointer-events: none; }
.caps-actions, .caps-hint { transition: opacity .35s; }
.caps-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.caps-name { font-family: var(--font-display); font-size: 30px; color: #fff; text-shadow: 0 0 18px var(--rc); }
.caps-rarity { font-size: 13px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--rc); }
.caps-dup { font-size: 12.5px; color: #c8ccd8; margin: 6px auto 0; max-width: 360px; }
.caps-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.caps-info .caps-actions { pointer-events: auto; margin-top: 18px; } /* после открытия кнопки внутри подписи награды */
.caps-open { min-width: 170px; }
.caps-hint { font-size: 12px; color: #9aa0b4; margin-top: 8px; }
.caps-msg { color: #ff9aa6; font-size: 13px; }
.caps-msg:empty { display: none; }
.caps-gone { display: none !important; }

/* капсулы в инвентаре */
/* при наведении вместо названия — «Открыть» на месте подписи */
/* (название остаётся невидимым — клетка не меняет высоту) */
.inv-item.capsule .ii-open {
  display: none; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: #ffd23f; color: #241500; white-space: nowrap;
}
.inv-item.capsule:hover .ii-name, .inv-item.capsule:focus-visible .ii-name { visibility: hidden; }
.inv-item.capsule:hover .ii-open, .inv-item.capsule:focus-visible .ii-open { display: block; }
.inv-empty { grid-column: 1 / -1; color: #9aa0b4; font-size: 13px; padding: 20px 8px; text-align: center; }
@media (max-width: 560px) {
  .caps-title { font-size: 26px; }
  .caps-drop { width: 74px; }
  .caps-drop-art { width: 58px; height: 58px; }
  .caps-drop-art canvas { width: 52px !important; height: 52px !important; }
}
.caps-drop .caps-odds { margin-top: 2px; color: #ffe08a; font-weight: 700; letter-spacing: .3px; }
.caps-drop.have .caps-odds { color: var(--muted); font-weight: 500; }
.caps-dup { margin-top: 6px; font-size: 14px; color: var(--muted); } .caps-dup b { color: #ffd23f; }
/* предпросмотр: особенности — иконки в ряд без рамок, подпись по наведению; со звуком — нажимаются */
.caps-pop { pointer-events: auto; }
.caps-pop-feats { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.caps-pop-feats:empty { display: none; }
.caps-feat { display: inline-flex; padding: 0; border: none; background: none; color: #ffd23f; filter: drop-shadow(0 1px 2px rgba(0,0,0,.9)); }
.caps-feat.can-play { cursor: pointer; transition: transform .12s; }
.caps-feat.can-play:hover { transform: scale(1.2); color: #fff3b0; }
