/* Кейсы и косметика хаба (webapp/loot.js).
 * Эффекты вокруг аватарки анимируются ТОЛЬКО transform и opacity — правило
 * плавности проекта (20.09.2026): box-shadow и filter в вечных анимациях
 * съедали кадры на слабых телефонах. При fx «выкл» — без движения. */

/* --- Аватарка в косметике ------------------------------------------------- */
.cos-ava {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: var(--s, 44px); height: var(--s, 44px); border-radius: 50%;
}
.cos-in {
  position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 50%;
  overflow: hidden; display: grid; place-items: center; background: #26262e;
}
.cos-ava.has-ring { padding: 3px; background: var(--ring); }
.cos-in > .hub-ava { width: 100%; height: 100%; border: 0; }
.cos-frame-img {
  position: absolute; inset: -14%; width: 128%; height: 128%; z-index: 2;
  object-fit: contain; pointer-events: none;
}
.cos-fx { position: absolute; inset: -18%; z-index: 0; border-radius: 50%; pointer-events: none; }
.cos-dot { width: 60%; height: 60%; border-radius: 50%; background: #3a3a44; }

.fx-halo .cos-fx {
  background: radial-gradient(circle, color-mix(in srgb, var(--fx) 60%, transparent) 42%, transparent 70%);
  animation: cos-breathe 2.6s ease-in-out infinite;
}
.fx-pulse .cos-fx { inset: -3%; border: 2px solid var(--fx); animation: cos-pulse 1.8s ease-out infinite; }
.fx-sparks .cos-fx {
  background:
    radial-gradient(circle at 50% 4%, var(--fx) 0 3%, transparent 4%),
    radial-gradient(circle at 96% 50%, var(--fx) 0 2.5%, transparent 3.5%),
    radial-gradient(circle at 50% 96%, var(--fx) 0 3%, transparent 4%),
    radial-gradient(circle at 4% 50%, var(--fx) 0 2.5%, transparent 3.5%),
    radial-gradient(circle at 85% 15%, var(--fx) 0 2%, transparent 3%),
    radial-gradient(circle at 15% 85%, var(--fx) 0 2%, transparent 3%);
  animation: cos-spin 6s linear infinite;
}
.fx-flame .cos-fx {
  inset: -24% -12% -6%; border-radius: 50% 50% 45% 45%; transform-origin: 50% 80%;
  background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--fx) 75%, transparent) 30%, transparent 68%);
  animation: cos-flicker 1.3s ease-in-out infinite alternate;
}
.fx-orbit .cos-fx {
  inset: -12%;
  background:
    radial-gradient(circle at 50% 3%, var(--fx) 0 5%, transparent 6%),
    radial-gradient(circle at 50% 97%, color-mix(in srgb, var(--fx) 60%, transparent) 0 3.5%, transparent 4.5%);
  border: 1px dashed color-mix(in srgb, var(--fx) 45%, transparent);
  animation: cos-spin 3.2s linear infinite;
}
@keyframes cos-breathe { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes cos-pulse { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.45); } }
@keyframes cos-spin { to { transform: rotate(360deg); } }
@keyframes cos-flicker { 0% { opacity: 0.65; transform: scaleY(0.94); } 50% { opacity: 1; transform: scaleY(1.06); } 100% { opacity: 0.75; transform: scaleY(0.98); } }
html[data-fx="off"] .cos-fx { animation: none; }

/* --- Образцы и редкость ---------------------------------------------------- */
.cos-sw {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: #26262e; overflow: hidden;
}
.cos-sw img { width: 100%; height: 100%; object-fit: contain; }
.cos-sw-t { font-weight: 900; color: #ffd84d; }
.r-common { --rc: #8a8f98; }
.r-rare { --rc: #3b82f6; }
.r-epic { --rc: #a855f7; }
.r-legend { --rc: #f59e0b; }
.r-seasonal { --rc: #e5484d; }

/* --- Страница ------------------------------------------------------------- */
.loot-me {
  display: flex; align-items: center; gap: 16px; padding: 18px 16px; margin-bottom: 8px;
  border-radius: 18px; background: #17171c; border: 1px solid rgba(255, 255, 255, 0.08);
}
.loot-me > span:last-child { display: grid; gap: 4px; min-width: 0; }
.loot-me b { font-size: 18px; }
.loot-me small { color: var(--h-dim, #a1a1aa); }
.loot-me-face { display: grid; place-items: center; width: 100%; height: 100%; font-size: 28px; font-weight: 800; }
.loot-me-face img { width: 100%; height: 100%; object-fit: cover; }

.loot-cases { display: grid; gap: 10px; margin: 8px 0 12px; }
.loot-case {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "art name count" "art odds odds" "btn btn btn";
  gap: 6px 12px; align-items: center; padding: 12px; border-radius: 16px;
  background: #17171c; border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent);
}
.loot-case-art { grid-area: art; width: 64px; height: 64px; display: grid; place-items: center; }
.loot-case-art img { width: 100%; height: 100%; object-fit: contain; }
.loot-case-box {
  width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center;
  font-size: 26px; font-weight: 900; color: var(--rc);
  background: linear-gradient(145deg, color-mix(in srgb, var(--rc) 35%, #1b1b22), #121217);
  border: 2px solid var(--rc);
}
.loot-case > b { grid-area: name; font-size: 16px; }
.loot-count { grid-area: count; font-weight: 800; color: var(--rc); }
.loot-chances { grid-area: odds; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--h-dim, #a1a1aa); }
.loot-chances li b { color: var(--h-text, #f5f5f7); margin-left: 4px; }
.loot-case > .btn { grid-area: btn; }

.loot-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.loot-item {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: 14px; cursor: pointer;
  background: #17171c; color: inherit; text-align: center;
  border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent);
}
.loot-item b { font-size: 12px; line-height: 1.25; }
.loot-item small { font-size: 11px; color: var(--h-dim, #a1a1aa); }
.loot-item.is-on { border-color: #ffffff; background: #22222a; }
.loot-titles { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.loot-title { padding: 4px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--rc); }

/* --- Рулетка -------------------------------------------------------------- */
.loot-roll {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 8, 0.9); color: #f5f5f7; font-family: var(--font-body);
}
.loot-roll-box { width: min(100%, 440px); display: grid; gap: 14px; justify-items: center; text-align: center; }
.loot-roll-title { font-size: 18px; letter-spacing: 0.08em; text-transform: uppercase; }
.loot-window {
  position: relative; width: 100%; overflow: hidden; padding: 12px 0;
  border-radius: 14px; background: #141418; border: 1px solid rgba(255, 255, 255, 0.08);
}
.loot-strip { display: flex; gap: 8px; will-change: transform; }
.loot-tile {
  flex: 0 0 96px; height: 118px; box-sizing: border-box; padding: 10px 6px; border-radius: 12px;
  display: grid; justify-items: center; align-content: center; gap: 6px;
  background: linear-gradient(180deg, #1d1d24, #141419); border-bottom: 3px solid var(--rc);
}
.loot-tile small { font-size: 10px; line-height: 1.2; color: #c9c9d1; max-height: 3.6em; overflow: hidden; }
.loot-glyph { display: grid; place-items: center; width: 40px; height: 40px; color: var(--rc); }
.loot-glyph .ic { width: 30px; height: 30px; }
.loot-needle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px;
  background: #ff5a36; border-radius: 2px;
}
.loot-result { display: grid; gap: 10px; justify-items: center; }
.loot-result .loot-tile { flex-basis: auto; width: 140px; height: 160px; }
.loot-result p { margin: 0; font-size: 15px; }
.loot-result-btns { display: flex; gap: 10px; }

/* Профиль хаба: аватарка в косметике над именем. */
.hub-sheet-ava { display: flex; justify-content: center; margin-bottom: 4px; }
.hub-sheet-ava .hub-ava { width: 100%; height: 100%; border: 0; }
.hub-loot { background: linear-gradient(120deg, rgba(245, 158, 11, 0.16), rgba(168, 85, 247, 0.1)), var(--h-card, #17171c); }

/* Кнопки результата — в стиле хаба, а не окна Системы. */
.loot-roll .btn { clip-path: none; border-radius: 12px; min-width: 120px; }
.loot-roll .btn-primary { background: #ffffff; color: #0a0a0a; border-color: transparent; box-shadow: none; }
.loot-roll .btn-ghost { background: rgba(255, 255, 255, 0.1); border-color: transparent; color: #f5f5f7; }

/* Эффект-картинка (генерация на чёрном) — медленно крутится вокруг. */
.cos-fx-img { inset: -24%; width: 148%; height: 148%; object-fit: contain; animation: cos-spin 12s linear infinite; }

/* --- Магазин (webapp/store.js) -------------------------------------------- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.st-card {
  display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 16px;
  background: #17171c; border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent);
}
.st-card.is-day { grid-template-columns: 96px minmax(0, 1fr); align-items: center; margin: 8px 0 12px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--rc) 22%, #17171c), #17171c); }
.st-card.is-day .st-buy { grid-column: 1 / -1; }
.st-prev { display: grid; place-items: center; min-height: 96px; }
.st-info { display: grid; gap: 3px; min-width: 0; }
.st-info b { font-size: 15px; }
.st-info small { color: var(--h-dim, #a1a1aa); font-size: 12px; }
.st-badge { justify-self: start; padding: 2px 8px; border-radius: 999px; background: #ff5a36; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; }
.st-buy { display: flex; flex-wrap: wrap; gap: 6px; }
.st-buy .btn { clip-path: none; border-radius: 10px; min-height: 34px; padding: 0 10px; }
.st-buy .btn-primary { background: #fff; color: #0a0a0a; border-color: transparent; box-shadow: none; }
.st-owned { font-size: 13px; color: #5bd98a; font-weight: 700; }
.st-bg-prev { display: block; width: 64px; height: 96px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12); }
.st-title-prev { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rc); font-weight: 800; text-align: center; }
.st-face { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 800; font-size: 22px; background: #26262e; }
.st-packs { display: grid; gap: 8px; margin: 8px 0 12px; }
.st-pack, .st-order {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border-radius: 14px; background: #17171c; border: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 6px;
}
.st-pack span, .st-order span { display: grid; gap: 2px; min-width: 0; }
.st-pack small, .st-order small { color: var(--h-dim, #a1a1aa); font-size: 12px; }
.st-pack .btn, .st-order .btn { clip-path: none; border-radius: 10px; flex: 0 0 auto; }
.st-order.is-paid { border-color: rgba(91, 217, 138, 0.4); }
.st-order.is-cancelled, .st-order.is-expired { opacity: 0.6; }

/* Панель: цены, выбор недели, каталог. */
.st-prices { display: grid; grid-template-columns: 90px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; margin-bottom: 10px; }
.st-prices b { font-size: 12px; }
.st-pick { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; margin: 8px 0; }
.st-pick-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.st-pick-row span { display: grid; }
.st-pick-row small { color: var(--ink-dim, #a3b7c4); font-size: 11px; }
.st-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 10px; }
.st-item { display: flex; align-items: center; gap: 8px; padding: 8px; text-align: left; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); color: inherit; cursor: pointer; }
.st-item span { display: grid; min-width: 0; }
.st-item b { font-size: 13px; }
.st-item small { font-size: 11px; opacity: 0.7; }
.st-item.is-off { opacity: 0.5; }
.st-form-prev { display: grid; place-items: center; padding: 10px; }

/* --- Рынок (webapp/market.js) --------------------------------------------- */
.hub-tool-wide { grid-column: 1 / -1; }
.mk-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mk-kinds .chip.is-on { background: #ffffff; color: #0a0a0a; }
.mk-lot {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; padding: 10px; margin-top: 8px; border-radius: 14px; text-align: left; color: inherit;
  background: #17171c; border: 1px solid color-mix(in srgb, var(--rc, #3a3a44) 40%, transparent);
}
.mk-lot.is-off { opacity: 0.55; }
button.mk-lot { cursor: pointer; }
.mk-prev { display: grid; place-items: center; width: 48px; height: 48px; }
.mk-card { width: 40px; height: 56px; object-fit: cover; border-radius: 6px; }
.mk-item .ic { width: 24px; height: 24px; }
.mk-info { display: grid; gap: 2px; min-width: 0; }
.mk-info b { font-size: 14px; overflow-wrap: anywhere; }
.mk-info small { font-size: 12px; color: var(--h-dim, #a1a1aa); }
.mk-tag { font-size: 12px; font-weight: 700; color: var(--h-dim, #a1a1aa); }
.mk-lot .btn { clip-path: none; border-radius: 10px; }
.mk-lot .btn-primary { background: #fff; color: #0a0a0a; border-color: transparent; box-shadow: none; }
.mk-warn { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 90, 54, 0.12); color: #ffb39c; font-size: 13px; }
.r-bronze { --rc: #c08551; } .r-silver { --rc: #b8c4cc; } .r-gold { --rc: #e8b54b; }
.r-platinum { --rc: #7fd4e8; } .r-diamond { --rc: #6fa8ff; } .r-master { --rc: #c77dff; } .r-challenger { --rc: #ff4d4d; }
.mk-kinds .chip {
  border-radius: 999px; padding: 5px 12px; font-size: 12px; clip-path: none;
  background: rgba(255, 255, 255, 0.08); border: 0; color: var(--h-text, #f5f5f7); cursor: pointer;
}
