/* =============================================================
   cosmetics.css — Cosmetic System
   Inventory modal, alien-skin glow layer, click-effect glow,
   and boss-effect screen overlays. Pure presentation — no
   selectors here ever influence layout/economy/progression.
   ============================================================= */

/* ── MODAL ──────────────────────────────────────────────────── */
.cos-modal-box {
  width: min(720px, 94vw);
  max-width: min(720px, 94vw); /* beat .modal-box's 440px cap on desktop */
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#cos-modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 6px 12px 2px;
  flex: 1;
}
#cos-modal-body::-webkit-scrollbar { width: 8px; }
#cos-modal-body::-webkit-scrollbar-thumb { background: rgba(200,123,255,0.35); border-radius: 4px; }
#cos-modal-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }

/* ── CRATE SOURCES — collapsed (Prompt 10) into one secondary caption
   line under the crate banner, so "how do I get more" doesn't compete
   visually with the crate banner / collection progress above it. ── */
.cos-crate-sources {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 2px;
  font-size: 0.62rem;
  line-height: 1.4;
  color: rgba(190,200,225,0.65);
}
.cos-src-chip {
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.cos-src-chip strong { color: rgba(220,180,255,0.95); font-weight: 700; }
.cos-src-icon { font-size: 0.85rem; line-height: 1; }
.cos-src-sep { color: rgba(200,123,255,0.3); }
.cos-src-mini-bar {
  display: inline-block;
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(200,123,255,0.14);
  overflow: hidden; vertical-align: middle;
}
.cos-src-mini-fill {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #c87bff, #8f4fff);
  transition: width 0.3s ease;
}
@media (max-width: 540px) {
  .cos-crate-sources { gap: 6px 10px; }
}

/* ── CRATE BAR ──────────────────────────────────────────────── */
.cos-crate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 14px;
  margin: 4px 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 208, 96, 0.25);
  background: rgba(255, 208, 96, 0.07);
}
.cos-crate-count {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffd060;
  letter-spacing: 0.02em;
}
.cos-crate-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.cos-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}
.cos-tab {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 44, 0.55);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cos-tab:hover { transform: translateY(-1px); color: var(--text); }
.cos-tab-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(80, 200, 255, 0.12);
  box-shadow: 0 0 14px rgba(80, 200, 255, 0.20);
}

.cos-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.cos-filter-chip {
  --chip-color: #8090b0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip-color) 40%, transparent);
  background: transparent;
  color: var(--chip-color);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.cos-filter-chip:hover { transform: translateY(-1px); }
.cos-filter-active {
  border-color: var(--chip-color);
  background: color-mix(in srgb, var(--chip-color) 32%, transparent);
  color: #fff;
  box-shadow: 0 0 12px color-mix(in srgb, var(--chip-color) 55%, transparent);
}
.cos-owned-toggle { margin-left: auto; }

.cos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.cos-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  padding: 28px 0;
  font-size: 0.9rem;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.cos-card {
  --rarity-color: #8090b0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rarity-color) 35%, var(--border));
  background: linear-gradient(180deg, rgba(18, 22, 42, 0.75), rgba(10, 12, 26, 0.75));
  text-align: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.cos-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35); }
.cos-card-is-equipped {
  border-color: var(--rarity-color);
  box-shadow: 0 0 0 1px var(--rarity-color), 0 0 18px color-mix(in srgb, var(--rarity-color) 40%, transparent);
}
.cos-card-locked { opacity: 0.62; filter: grayscale(0.4); animation: lockedIdleGlow 3.6s ease-in-out infinite; }
.cos-card-locked:hover { opacity: 0.82; filter: grayscale(0.15); }

/* Mythic — the rarest tier gets a slow prismatic aura instead of a static glow */
.cos-card-mythic { animation: cosMythicCardAura 3.4s ease-in-out infinite; }
@keyframes cosMythicCardAura {
  0%, 100% { box-shadow: 0 0 14px color-mix(in srgb, var(--rarity-color) 38%, transparent); }
  50%      { box-shadow: 0 0 28px color-mix(in srgb, var(--rarity-color) 60%, transparent), 0 0 10px rgba(120,200,255,0.35); }
}

.cos-card-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(6, 8, 18, 0.7);
}
.cos-card-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.2;
}
.cos-card-locked-icon { opacity: 0.7; font-size: 0.78rem; }
.cos-card-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: -4px;
}
.cos-card-rarity {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cos-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.cos-card-equip-btn, .cos-card-preview-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(80, 200, 255, 0.10);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.cos-card-equip-btn { border-color: var(--accent); color: var(--accent); }
.cos-card-equip-btn:hover, .cos-card-preview-btn:hover { transform: scale(1.05); background: rgba(80, 200, 255, 0.20); }
.cos-card-equipped {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.02em;
}
.cos-card-hint {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.35;
  padding: 0 2px;
  cursor: help;
}
.cos-card-hint-icon { font-size: 0.9rem; }
.cos-card-hint-cap  { font-weight: 600; letter-spacing: 0.2px; }

/* ── PREVIEW PANELS ─────────────────────────────────────────── */
.cos-preview {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(4, 6, 14, 0.6);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.cos-preview-skin { flex-direction: column; gap: 4px; }
.cos-preview-orb {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--prev-glow, #50c8ff) 60%, transparent 100%);
  filter: hue-rotate(var(--prev-hue, 0deg)) saturate(var(--prev-sat, 1)) brightness(var(--prev-bright, 1));
  box-shadow: 0 0 16px var(--prev-glow, transparent);
}
.cos-preview-label { font-size: 0.64rem; color: var(--text-dim); }
.cos-preview-swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.cos-preview-dot { border-radius: 50%; width: 16px; height: 16px; }
.cos-preview-boss {
  width: 100%; height: 18px;
  border-radius: 6px;
}

/* =============================================================
   ALIEN SKIN — active glow accents (recolor handled via the
   --alien-world-* custom properties already consumed by the
   alienWorldPulse animation in layout.css; see cosmeticSystem.js)
   ============================================================= */
.alien-btn.cos-skin-glow {
  filter: drop-shadow(0 0 10px var(--alien-glow, transparent));
}
.alien-img.cos-skin-animated {
  animation: cosSkinShimmer 2.6s ease-in-out infinite;
}
@keyframes cosSkinShimmer {
  0%, 100% { filter: brightness(1) saturate(1); }
  50%      { filter: brightness(1.12) saturate(1.18); }
}
/* Mythic skins — additive prismatic aura ring on the button (never touches
   the img's filter pipeline, so it can't fight alienWorldPulse/shimmer) */
.alien-btn.cos-skin-mythic {
  animation: cosMythicAura 3.2s ease-in-out infinite;
}
@keyframes cosMythicAura {
  0%, 100%   { box-shadow: 0 0 22px rgba(255,95,214,0.55), inset 0 0 10px rgba(120,200,255,0.30); }
  50%        { box-shadow: 0 0 36px rgba(120,200,255,0.55), inset 0 0 14px rgba(255,95,214,0.40); }
}

/* =============================================================
   CLICK EFFECT — additive glow layer on the alien button.
   Subtle, fast (<300ms), purely decorative.
   ============================================================= */
.alien-btn.cos-click-fx.glow-pulse {
  box-shadow: 0 0 0 0 transparent;
}
.alien-btn.cos-click-fx.glow-pulse::after {
  content: '';
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cos-click-glow, transparent) 0%, transparent 68%);
  opacity: 0;
  pointer-events: none;
  animation: cosClickGlow 0.28s ease-out forwards;
}
@keyframes cosClickGlow {
  0%   { opacity: 0.55; transform: scale(0.85); }
  100% { opacity: 0;    transform: scale(1.18); }
}

/* =============================================================
   BOSS EFFECT — screen-edge glow / ambient shift while the boss
   world is open. Pure CSS overlay on body::before — never
   intercepts pointer events, never covers boss UI.
   ============================================================= */
body[class*="cos-boss-fx-"]::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
body.cos-boss-fx-ember_aura::before {
  background:
    radial-gradient(ellipse at top,    rgba(255,128,64,0.35) 0%, transparent 38%),
    radial-gradient(ellipse at bottom, rgba(255,96,32,0.10)  0%, transparent 55%);
  animation: cosBossEmberPulse 4.5s ease-in-out infinite;
}
body.cos-boss-fx-void_pulse::before {
  background:
    radial-gradient(ellipse at top,    rgba(144,80,255,0.40) 0%, transparent 40%),
    radial-gradient(ellipse at bottom, rgba(96,32,255,0.12)  0%, transparent 58%);
  animation: cosBossVoidPulse 5.5s ease-in-out infinite;
}
@keyframes cosBossEmberPulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}
@keyframes cosBossVoidPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.95; transform: scale(1.03); }
}

/* Mythic — "unique full-screen style effect + particles": a slow prismatic
   sweep (conic-gradient) plus drifting sparkle motes (radial-gradient dots).
   Still pure CSS, still inert to pointer events, still layered beneath the
   boss UI (z-index: 2, see body[class*="cos-boss-fx-"]::before above). */
body.cos-boss-fx-prismatic_surge::before {
  background:
    radial-gradient(circle at 18% 28%, rgba(255,255,255,0.20) 0%, transparent 1.6%),
    radial-gradient(circle at 78% 22%, rgba(255,255,255,0.16) 0%, transparent 1.3%),
    radial-gradient(circle at 32% 74%, rgba(255,255,255,0.18) 0%, transparent 1.5%),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,0.14) 0%, transparent 1.2%),
    conic-gradient(from 0deg at 50% 50%,
      rgba(255,95,214,0.16), rgba(120,200,255,0.16),
      rgba(255,224,128,0.14), rgba(255,95,214,0.16));
  mix-blend-mode: screen;
  animation: cosBossPrismaticSpin 22s linear infinite, cosBossPrismaticTwinkle 3.2s ease-in-out infinite;
}
@keyframes cosBossPrismaticSpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes cosBossPrismaticTwinkle {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 0.95; }
}

@media (max-width: 560px) {
  .cos-modal-box { width: 96vw; max-height: 90vh; }
  .cos-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 9px; }
}

/* ── CRATE BAR REDESIGN ─────────────────────────────────────── */
.cos-crate-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.cos-crate-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.cos-crate-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cos-crate-open-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 208, 96, 0.50);
  background: rgba(255, 208, 96, 0.14);
  color: #ffd060;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.cos-crate-open-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 208, 96, 0.24);
  box-shadow: 0 4px 14px rgba(255, 208, 96, 0.25);
}
.cos-crate-open-btn--empty {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: rgba(200,180,240,0.55);
}
.cos-crate-open-btn--empty:hover { transform: none; background: rgba(255,255,255,0.05); box-shadow: none; }
/* "All Unlocked" — owns every crate cosmetic; informational, not a dead end */
.cos-crate-open-btn--done {
  border-color: rgba(122,255,192,0.45);
  background: rgba(122,255,192,0.10);
  color: #7affc0;
  cursor: default;
}
.cos-crate-open-btn--done:hover {
  transform: none;
  background: rgba(122,255,192,0.16);
  box-shadow: none;
}
.cos-src-label { font-size: 0.85rem; margin-right: 2px; cursor: help; }

/* ── Top panel — merges Collection Progress + Crate Bar into one card
   instead of two stacked boxes (Box overload reduction, UX Pass 2) ── */
.cos-top-panel {
  margin: 4px 0 12px;
  padding: 12px 14px 2px;
  border-radius: 12px;
  border: 1px solid rgba(200,160,255,0.16);
  background: linear-gradient(160deg, rgba(200,123,255,0.045), rgba(255,208,96,0.035));
}
.cos-top-panel .cos-overview {
  margin: 0; padding: 0; border: none; background: none;
}
.cos-top-panel .cos-crate-bar {
  margin: 10px 0 10px; padding: 10px 0 0; border: none; background: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
}
.cos-top-panel .cos-crate-sources { margin: 0; padding: 0 0 8px; }

/* ── TAB LABEL + COUNT ──────────────────────────────────────── */
.cos-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cos-tab-label { font-size: 0.82rem; font-weight: 700; }
.cos-tab-count { font-size: 0.66rem; font-weight: 600; color: var(--text-dim); }
.cos-tab-active .cos-tab-count { color: var(--accent); }

/* ── UNEQUIP BUTTON ─────────────────────────────────────────── */
.cos-card-unequip-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(61,255,160,0.40);
  background: rgba(61,255,160,0.10);
  color: var(--green);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.cos-card-unequip-btn:hover { transform: scale(1.05); background: rgba(61,255,160,0.20); }

/* ── FULL-SCREEN PREVIEW MODAL ──────────────────────────────── */
.cos-prev-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 6, 14, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cos-prev-box {
  position: relative;
  background: linear-gradient(180deg, rgba(14, 18, 38, 0.97), rgba(8, 10, 22, 0.97));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 28px 24px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.cos-prev-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.07);
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.cos-prev-close:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.cos-prev-rarity-tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 999px;
  padding: 3px 10px;
}
.cos-prev-name {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
}
.cos-prev-content { width: 100%; }
.cos-prev-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Skin preview */
.cos-prev-skin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0 8px;
}
.cos-prev-alien-img {
  width: 140px; height: 140px;
  object-fit: contain;
  border-radius: 14px;
  animation: cosPrevSkinPulse 2.6s ease-in-out infinite;
}
@keyframes cosPrevSkinPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
.cos-prev-alien-name {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-ui);
}

/* Theme preview */
.cos-prev-theme-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
}
.cos-prev-theme-panel {
  width: 200px;
  border-radius: 10px;
  border: 1px solid;
  overflow: hidden;
  padding: 0;
}
.cos-prev-theme-accent-bar { height: 6px; width: 100%; animation: cosPrevThemeShimmer 2.4s ease-in-out infinite; }
@keyframes cosPrevThemeShimmer {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}
.cos-prev-theme-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 4px;
  border-radius: 6px;
}
.cos-prev-theme-dot { width: 10px; height: 10px; border-radius: 50%; }
.cos-prev-theme-line { height: 6px; flex: 1; border-radius: 3px; }
.cos-prev-caption {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-ui);
}

/* Click effect preview — a real tap-target that fires the actual
   in-game particle burst, so the player sees exactly what they're buying. */
.cos-prev-click-wrap.cos-prev-click-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 0;
  border-radius: 14px;
  border: 2px dashed rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.cos-prev-click-wrap.cos-prev-click-target:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.30);
}
.cos-prev-click-wrap.cos-prev-click-target:active { transform: scale(0.97); }
.cos-prev-click-target-icon {
  font-size: 1.8rem;
  animation: cosPrevTapBounce 1.4s ease-in-out infinite;
}
@keyframes cosPrevTapBounce {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(-6px); opacity: 1; }
}
.cos-prev-caption-tap { font-weight: 700; letter-spacing: 0.3px; }

/* Boss effect preview — a small sample frame plus a real tap-triggered
   full-screen glow (same body class used in actual boss fights). */
.cos-prev-boss-wrap.cos-prev-boss-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0 8px;
  cursor: pointer;
}
.cos-prev-boss-frame {
  width: 100%; height: 90px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 0 0 2px var(--edge-color, #ff5fd6), inset 0 0 26px var(--edge-color, #ff5fd6);
  animation: cosPrevBossFramePulse 1.6s ease-in-out infinite;
}
@keyframes cosPrevBossFramePulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--edge-color, #ff5fd6), inset 0 0 14px var(--edge-color, #ff5fd6); }
  50%      { box-shadow: inset 0 0 0 3px var(--edge-color, #ff5fd6), inset 0 0 32px var(--edge-color, #ff5fd6); }
}

@media (max-width: 480px) {
  .cos-prev-box { padding: 20px 16px 18px; border-radius: 14px; }
  .cos-prev-alien-img { width: 110px; height: 110px; }
}

/* =============================================================
   COLLECTION OVERVIEW (Prompt 7, Phase 3) — overall %, milestone
   checkpoints, and a "closest to completion" hint. Derived purely
   from existing registry + STATE.cosmetics.owned data.
   ============================================================= */
.cos-overview {
  margin: 4px 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(200,123,255,0.18);
  background: rgba(200,123,255,0.05);
}
.cos-ov-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.cos-ov-title {
  font-family: var(--font-hd);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(220,180,255,0.9);
}
.cos-ov-count {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}
.cos-ov-bar {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  margin-bottom: 8px;
}
.cos-ov-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #c87bff, #50c8ff);
  transition: width 0.4s ease;
}
.cos-ov-milestone {
  position: absolute;
  top: -3px;
  width: 2px; height: 14px;
  border-radius: 1px;
  background: rgba(255,255,255,0.22);
  transform: translateX(-1px);
}
.cos-ov-milestone-hit {
  background: #ffd060;
  box-shadow: 0 0 6px #ffd060;
}
.cos-ov-closest {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.cos-ov-closest strong { color: var(--text); }
.cos-ov-complete { color: #ffd060; font-weight: 700; }

/* ── Tab "NEW" indicator dot (Phase 6: discoverability) ──────── */
.cos-tab-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: #ff5fd6;
  box-shadow: 0 0 6px #ff5fd6;
  vertical-align: middle;
  animation: cosTabDotPulse 1.6s ease-in-out infinite;
}
@keyframes cosTabDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.7); }
}

/* ── "Currently Equipped" strip (Phase 4) ────────────────────── */
.cos-equipped-strip {
  --eq-color: #50c8ff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 0 0 10px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--eq-color) 30%, var(--border));
  background: color-mix(in srgb, var(--eq-color) 8%, transparent);
}
.cos-eq-dot {
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--eq-color);
  box-shadow: 0 0 8px var(--eq-color);
}
.cos-eq-label {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.cos-eq-value {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
}

/* ── Card highlight — landing flash when a reveal's "View" CTA
   scrolls a specific card into view (Phase 6) ───────────────── */
.cos-card-highlight {
  animation: cosCardHighlight 1.6s ease-out;
}
@keyframes cosCardHighlight {
  0%   { box-shadow: 0 0 0 0 rgba(200,123,255,0); transform: scale(1); }
  15%  { box-shadow: 0 0 0 3px rgba(200,123,255,0.85), 0 0 24px rgba(200,123,255,0.55); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 rgba(200,123,255,0); transform: scale(1); }
}

/* =============================================================
   COSMETIC REWARD REVEAL (Prompt 7, Phase 1) — lightweight (1-3s),
   rarity-coded toast distinct from generic notifications. Sits
   below the header, never blocks input (overlay is pointer-events:
   none; only the card itself is interactive).
   ============================================================= */
.cos-reveal-overlay {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  justify-content: center;
  pointer-events: none;
  width: min(320px, calc(100vw - 24px));
}
.cos-reveal-card {
  --reveal-color: #50c8ff;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 14px 18px 12px;
  border-radius: 14px;
  border: 1px solid var(--reveal-color);
  background: linear-gradient(180deg, rgba(14,18,38,0.97), rgba(8,10,22,0.97));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--reveal-color) 35%, transparent),
    0 12px 36px rgba(0,0,0,0.5),
    0 0 22px color-mix(in srgb, var(--reveal-color) 35%, transparent);
  opacity: 0;
  transform: translateY(-18px) scale(0.92);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.cos-reveal-overlay.cos-reveal-visible .cos-reveal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.cos-reveal-card.cos-reveal-completion {
  --reveal-color: #ffd060;
}
.cos-reveal-card.cos-reveal-legendary,
.cos-reveal-card.cos-reveal-mythic,
.cos-reveal-card.cos-reveal-completion {
  animation: cosRevealAura 1.8s ease-in-out infinite;
}
@keyframes cosRevealAura {
  0%, 100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--reveal-color) 35%, transparent),
      0 12px 36px rgba(0,0,0,0.5),
      0 0 18px color-mix(in srgb, var(--reveal-color) 35%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--reveal-color) 60%, transparent),
      0 12px 36px rgba(0,0,0,0.5),
      0 0 34px color-mix(in srgb, var(--reveal-color) 60%, transparent);
  }
}
.cos-reveal-tag {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 999px;
  padding: 3px 10px;
}
.cos-reveal-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin: 5px 0 1px;
}
.cos-reveal-overlay.cos-reveal-visible .cos-reveal-icon {
  animation: cosRevealIconPop 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cosRevealIconPop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.cos-reveal-name {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}
.cos-reveal-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
}
.cos-reveal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.cos-reveal-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--reveal-color);
  background: color-mix(in srgb, var(--reveal-color) 16%, transparent);
  color: var(--reveal-color);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.76rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.cos-reveal-btn:hover { transform: scale(1.05); background: color-mix(in srgb, var(--reveal-color) 30%, transparent); }
.cos-reveal-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.cos-reveal-close:hover { background: rgba(255,255,255,0.14); color: var(--text); }

@media (max-width: 560px) {
  .cos-reveal-overlay { top: 64px; }
  .cos-overview { padding: 8px 10px; }
  .cos-ov-title { font-size: 0.56rem; }
  .cos-ov-count { font-size: 0.76rem; }
}

/* =============================================================
   CRATE OPENING ROULETTE — vertical decelerating reel.
   Deliberately different from the chest's horizontal slot strip
   so opening a crate "feels different" from opening a chest.
   ============================================================= */
.crate-roulette-overlay {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2,2,12,0);
  transition: background 0.25s ease;
}
.crate-roulette-overlay.crr-visible {
  background: rgba(2,2,12,0.78);
}
.crr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 30px 26px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(22,16,42,0.97), rgba(8,8,20,0.98));
  border: 1px solid rgba(144,96,255,0.35);
  box-shadow: 0 0 50px rgba(144,96,255,0.25), 0 20px 60px rgba(0,0,0,0.6);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.crate-roulette-overlay.crr-visible .crr-card {
  opacity: 1;
  transform: scale(1);
}
.crr-tag {
  font-family: var(--font-hd);
  font-size: 0.66rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #c0a0ff;
  text-shadow: 0 0 10px rgba(144,96,255,0.6);
}
.crr-reel-wrap {
  position: relative;
  width: 118px;
  height: 216px; /* 3 cells visible */
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
}
.crr-reel {
  position: absolute;
  left: 0; right: 0; top: 0;
  will-change: transform;
}
.crr-cell {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crr-cell-icon {
  font-size: 2.3rem;
  line-height: 1;
}
.crr-selector {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 72px;
  transform: translateY(-50%);
  border-top: 2px solid rgba(255,255,255,0.55);
  border-bottom: 2px solid rgba(255,255,255,0.55);
  box-shadow: inset 0 0 18px rgba(255,255,255,0.10);
  pointer-events: none;
}
.crr-fade-top, .crr-fade-bottom {
  position: absolute;
  left: 0; right: 0;
  height: 60px;
  pointer-events: none;
}
.crr-fade-top    { top: 0;    background: linear-gradient(180deg, rgba(14,10,28,0.95), transparent); }
.crr-fade-bottom { bottom: 0; background: linear-gradient(0deg, rgba(14,10,28,0.95), transparent); }

/* Rarity tints for filler/result icons */
.crr-cell.crr-rarity-common    { color: #a0c8e0; }
.crr-cell.crr-rarity-rare      { color: #50c8ff; }
.crr-cell.crr-rarity-epic      { color: #c070ff; }
.crr-cell.crr-rarity-mythic    { color: #ff5fd6; filter: drop-shadow(0 0 10px rgba(255,95,214,0.7)); }
.crr-cell.crr-rarity-legendary { color: #ffd060; filter: drop-shadow(0 0 12px rgba(255,208,96,0.8)); }

/* Visual-only near-miss flash — never affects the outcome */
.crr-near-miss {
  animation: crrNearMissFlash 0.5s ease-in-out;
}
@keyframes crrNearMissFlash {
  0%   { box-shadow: none; background: transparent; }
  40%  { box-shadow: inset 0 0 24px rgba(255,208,96,0.6); background: rgba(255,208,96,0.14); }
  100% { box-shadow: none; background: transparent; }
}
/* Winning cell lands with a confident pop */
.crr-winner {
  animation: crrWinnerPop 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes crrWinnerPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* =============================================================
   SET-COMPLETION CELEBRATION — fullscreen-feeling upgrade.
   Same .cos-reveal-completion card, but with a dim full-viewport
   backdrop and confetti burst behind it for a more memorable moment.
   ============================================================= */
.cos-reveal-overlay.cos-reveal-visible:has(.cos-reveal-completion) {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  transform: none;
  width: 100%;
  height: 100%;
  background: rgba(2,2,12,0.72);
  pointer-events: auto;
}
.cos-reveal-overlay.cos-reveal-visible:has(.cos-reveal-completion) .cos-reveal-card {
  transform: translateY(0) scale(1.08);
}
.cos-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.cos-confetti-piece {
  position: absolute;
  top: -10%;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: cosConfettiFall 1.8s ease-in forwards;
}
@keyframes cosConfettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

body.reduced-motion .cos-prev-alien-img,
body.reduced-motion .cos-prev-click-dot,
body.reduced-motion .cos-prev-boss-bar,
body.reduced-motion .cos-prev-theme-accent-bar {
  animation: none;
}
