/* Cosmetics gallery + the cosmetic dialog (also used on the account page). */

.toolbar { position: sticky; top: 86px; z-index: 20; margin-top: 40px; padding: 10px; border-radius: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.slot-tabs { display: flex; gap: 4px; flex-wrap: wrap; scrollbar-width: none; }
.slot-tabs::-webkit-scrollbar { display: none; }
.slot-tabs button { font-size: 14px; font-weight: 600; color: var(--muted); padding: 9px 16px; border-radius: 99px; transition: color 0.2s, background 0.3s; }
.slot-tabs button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.slot-tabs button[aria-selected="true"] { color: #fff; background: linear-gradient(110deg, var(--accent), var(--accent2)); box-shadow: 0 6px 20px -8px rgba(var(--accent-rgb), 0.9); }
.slot-tabs .n { margin-left: 6px; font-size: 12px; opacity: 0.7; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rarity-filter { display: flex; gap: 4px; }
.rarity-filter button { --r: var(--common); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); transition: border-color 0.2s, background 0.2s; }
.rarity-filter button::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--r); box-shadow: 0 0 10px var(--r); }
.rarity-filter button[aria-pressed="true"] { border-color: var(--r); background: rgba(255, 255, 255, 0.06); }
.rarity-filter button.r-mythic::before { background: conic-gradient(#ff4fa3, #ffb23f, #4cf5a0, #3dd6ff, #b46bff, #ff4fa3); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line2); }
.search:focus-within { border-color: rgba(var(--accent2-rgb), 0.6); }
.search svg.i { width: 16px; height: 16px; color: var(--dim); }
.search input { background: none; border: 0; outline: none; width: 160px; font-size: 14px; }
.search input::placeholder { color: var(--dim); }
.owned-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; padding: 0 6px; }
.owned-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.result-count { margin: 22px 4px 0; font-size: 14px; color: var(--dim); }
.cosmetic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.cos-card { --r: var(--common); position: relative; display: flex; flex-direction: column; text-align: left; border-radius: 18px; overflow: hidden;
  border-top: 2px solid var(--r) !important; transition: transform 0.45s var(--spring), box-shadow 0.3s; animation: rise 0.5s var(--ease) both; }
.cos-card:hover { transform: translateY(-6px); box-shadow: 0 22px 44px -18px var(--r); }
.cos-card.r-mythic { border-top-color: transparent !important; }
.cos-card.r-mythic::before { content: ""; position: absolute; z-index: 2; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, #ff4fa3, #ffb23f, #4cf5a0, #3dd6ff, #b46bff, #ff4fa3); background-size: 200% 100%; animation: chroma 4s linear infinite; }
.cos-card .thumb { position: relative; aspect-ratio: 1; overflow: hidden; background: #0c0a16; }
.cos-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.cos-card:hover .thumb img { transform: scale(1.06); }
.cos-card .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8, 7, 13, 0.6)); }
.cos-card .info { padding: 12px 14px 14px; }
.cos-card b { display: block; font-size: 15.5px; }
.cos-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.cos-card .slot-label { font-size: 12px; color: var(--dim); }
.cos-card .state { position: absolute; z-index: 1; top: 10px; right: 10px; }
.state-worn { background: linear-gradient(110deg, var(--accent), var(--accent2)); color: #fff; }
.state-owned { background: rgba(76, 245, 160, 0.16); color: var(--good); }
.state-price { background: rgba(255, 178, 63, 0.16); color: var(--legendary); }
.state-locked { background: rgba(0, 0, 0, 0.5); color: var(--muted); }
.empty { margin-top: 16px; padding: 28px; border-radius: 18px; text-align: center; color: var(--muted); }

/* ---- dialog */
.cosmetic-modal { width: min(880px, calc(100% - 32px)); margin: auto; padding: 0; border-radius: 24px; color: var(--text); overflow: hidden;
  display: none; grid-template-columns: 1fr 1fr; border: 1px solid var(--line2); }
.cosmetic-modal[open] { display: grid; animation: rise 0.35s var(--ease); }
.cosmetic-modal::backdrop { background: rgba(4, 3, 8, 0.7); backdrop-filter: blur(6px); }
.modal-close { position: absolute; z-index: 3; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(8, 7, 13, 0.6); border: 1px solid var(--line2); }
.modal-close:hover { background: rgba(255, 255, 255, 0.1); }
.modal-media { position: relative; aspect-ratio: 1; background: #0c0a16; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-viewer { position: absolute; inset: 0; background: radial-gradient(circle at 50% 70%, rgba(var(--accent-rgb), 0.35), transparent 65%), #0c0a16; cursor: grab; }
.modal-viewer canvas { width: 100%; height: 100%; }
.modal-body { padding: 32px 30px; display: flex; flex-direction: column; }
.modal-body h2 { margin-top: 6px; font-size: clamp(28px, 3.2vw, 38px); }
.modal-slot { margin-top: 6px; color: var(--dim); font-size: 14px; }
.modal-desc { margin-top: 16px; color: #d8d4f0; font-size: 16.5px; }
.modal-status { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-actions .btn { width: 100%; }
.modal-actions .note { font-size: 13px; color: var(--dim); text-align: center; }

@media (max-width: 860px) {
  .toolbar { top: 76px; }
  .filters { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
}
@media (max-width: 720px) {
  .cosmetic-modal[open] { grid-template-columns: 1fr; max-height: calc(100% - 32px); overflow-y: auto; }
  .modal-media { aspect-ratio: 4 / 3; }
  .cosmetic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .slot-tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .slot-tabs button { flex-shrink: 0; }
  .toolbar { position: static; }
}
