/* Cosmetic display — store item previews & equipped styles */

.cos-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    vertical-align: middle;
    line-height: 0;
    flex-shrink: 0;
}

.cos-avatar-wrap .user-avatar,
.cos-avatar-wrap .web-avatar {
    position: relative;
    z-index: 1;
}

.cos-avatar-wrap--has-ring .user-avatar,
.cos-avatar-wrap--has-ring .web-avatar {
    border: none;
}

/* Frames (thin rings) */
.cos-frame-bronze .user-avatar__clip,
.cos-frame-bronze .web-avatar { box-shadow: 0 0 0 2px #cd7f32, 0 0 10px rgba(205, 127, 50, 0.45); }
.cos-frame-silver .user-avatar__clip,
.cos-frame-silver .web-avatar { box-shadow: 0 0 0 2px #c0c8d8, 0 0 10px rgba(192, 200, 216, 0.5); }
.cos-frame-gold .user-avatar__clip,
.cos-frame-gold .web-avatar { box-shadow: 0 0 0 2px #ffc947, 0 0 12px rgba(255, 201, 71, 0.55); }
.cos-frame-diamond .user-avatar__clip,
.cos-frame-diamond .web-avatar { box-shadow: 0 0 0 2px #7ee8ff, 0 0 14px rgba(126, 232, 255, 0.6); }
.cos-frame-police .user-avatar__clip,
.cos-frame-police .web-avatar { box-shadow: 0 0 0 2px #4a90d9, 0 0 12px rgba(74, 144, 217, 0.5); }
.cos-frame-daroga .user-avatar__clip,
.cos-frame-daroga .web-avatar { box-shadow: 0 0 0 2px #5eb8ff, 0 0 12px rgba(94, 184, 255, 0.5); }
.cos-frame-thief .user-avatar__clip,
.cos-frame-thief .web-avatar { box-shadow: 0 0 0 2px #8b5cf6, 0 0 12px rgba(139, 92, 246, 0.5); }
.cos-frame-dakat .user-avatar__clip,
.cos-frame-dakat .web-avatar { box-shadow: 0 0 0 2px #e85d5d, 0 0 12px rgba(232, 93, 93, 0.5); }

/* Animated borders */
.cos-border-glow.cos-avatar-wrap::after,
.cos-border-glow.cos-preview-ring::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(255, 201, 71, 0.85);
    box-shadow: 0 0 10px rgba(255, 201, 71, 0.45);
    animation: cos-pulse 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
.cos-border-fire.cos-avatar-wrap::after,
.cos-border-fire.cos-preview-ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff4500, #ff6b35, #ffc947, #ff6b35, #ff4500);
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: cos-spin 2s linear infinite, cos-fire-flicker 0.9s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
.cos-border-neon.cos-avatar-wrap::after,
.cos-border-neon.cos-preview-ring::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    box-shadow: 0 0 10px #0ff, 0 0 20px #f0f, 0 0 30px rgba(0, 255, 255, 0.35);
    border: 2px solid #0ff;
    animation: cos-neon 1.6s ease-in-out infinite alternate, cos-neon-pulse 2.2s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
.cos-border-rainbow.cos-avatar-wrap::after,
.cos-border-rainbow.cos-preview-ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(red, orange, yellow, lime, cyan, blue, violet, red);
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: cos-spin 2.5s linear infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes cos-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); box-shadow: 0 0 6px rgba(255, 201, 71, 0.25); }
    50% { opacity: 1; transform: scale(1.07); box-shadow: 0 0 20px rgba(255, 201, 71, 0.8); }
}
@keyframes cos-spin { to { transform: rotate(360deg); } }
@keyframes cos-fire-flicker {
    0%, 100% { opacity: 0.82; filter: brightness(1); }
    50% { opacity: 1; filter: brightness(1.25); }
}
@keyframes cos-neon {
    from { filter: hue-rotate(0deg) saturate(1.1); border-color: #0ff; }
    to { filter: hue-rotate(55deg) saturate(1.4); border-color: #f0f; }
}
@keyframes cos-neon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.player-display-name {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 5px;
    max-width: 100%;
    vertical-align: middle;
}
.player-display-name .cos-title-pill { margin-right: 0; flex-shrink: 0; }
.player-display-name .cos-badge { margin-left: 0; flex-shrink: 0; }

/* Titles */
.cos-title-pill {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    margin-right: 6px;
    vertical-align: middle;
}
.cos-title-vip { background: linear-gradient(90deg, #ffc947, #ff9f43); color: #1a1200; }
.cos-title-detective { background: #2a3f5f; color: #8ec8ff; border: 1px solid #4a90d9; }
.cos-title-daroga { background: #1e3a5f; color: #ffd700; border: 1px solid #5eb8ff; }
.cos-title-thief { background: #2d1f3d; color: #c9a0ff; border: 1px solid #8b5cf6; }

/* Badges */
.cos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    margin-left: 4px;
    vertical-align: middle;
}
.cos-badge-bronze { filter: drop-shadow(0 0 4px rgba(205, 127, 50, 0.6)); }
.cos-badge-silver { filter: drop-shadow(0 0 4px rgba(192, 200, 216, 0.7)); }
.cos-badge-gold { filter: drop-shadow(0 0 6px rgba(255, 201, 71, 0.8)); }
.cos-badge-diamond { filter: drop-shadow(0 0 8px rgba(126, 232, 255, 0.9)); }

/* Username colors */
.cos-name-gold { color: #ffc947 !important; text-shadow: 0 0 12px rgba(255, 201, 71, 0.35); }
.cos-name-red { color: #ff5c6c !important; }
.cos-name-blue { color: #5eb8ff !important; }
.cos-name-purple { color: #b88cff !important; }
.cos-name-green { color: #5dffb0 !important; }

/* Profile backgrounds */
.cos-profile-bg {
    background-size: cover;
    background-position: center;
}
.cos-bg-dark-city { background-image: linear-gradient(160deg, #0a0e17 0%, #1a1f35 40%, #2d1b4e 100%); }
.cos-bg-police-station { background-image: linear-gradient(160deg, #0d1b2a 0%, #1b3a5c 50%, #0a1628 100%); }
.cos-bg-wanted { background-image: linear-gradient(160deg, #3d2914 0%, #8b6914 30%, #2a1810 100%); }
.cos-bg-royal { background-image: linear-gradient(160deg, #1a1208 0%, #4a3728 40%, #2a1f0f 100%); }
.cos-bg-neon-street { background-image: linear-gradient(160deg, #0a0e17 0%, #1a0a2e 40%, #0a2838 100%); }

/* Card themes (on role cards) */
.cos-card-classic { --card-accent: var(--gold); }
.cos-card-royal { --card-accent: #ffc947; --card-bg: linear-gradient(145deg, #2a2210, #1a1508); }
.cos-card-dark { --card-accent: #c5d4ea; --card-bg: linear-gradient(145deg, #12151c, #0a0c10); }
.cos-card-neon { --card-accent: #7fffd4; --card-bg: linear-gradient(145deg, #0a1620, #1a0a28); }
.cos-card-police { --card-accent: #8ec8ff; --card-bg: linear-gradient(145deg, #0d1f3a, #1a3055); }
.cos-card-thief { --card-accent: #c9a0ff; --card-bg: linear-gradient(145deg, #1a1028, #2d1a42); }

.role-card.cos-card-royal,
.role-card.cos-card-dark,
.role-card.cos-card-neon,
.role-card.cos-card-police,
.role-card.cos-card-thief {
    background: var(--card-bg) !important;
    color: var(--card-accent) !important;
}
.role-card.cos-card-royal .role-card__label,
.role-card.cos-card-dark .role-card__label,
.role-card.cos-card-neon .role-card__label,
.role-card.cos-card-police .role-card__label,
.role-card.cos-card-thief .role-card__label,
.role-card.cos-card-royal .role-card__pts,
.role-card.cos-card-dark .role-card__pts,
.role-card.cos-card-neon .role-card__pts,
.role-card.cos-card-police .role-card__pts,
.role-card.cos-card-thief .role-card__pts {
    color: inherit;
    opacity: 0.95;
}

/* Store UI */
.store-page { max-width: 520px; margin: 0 auto; padding-bottom: 32px; }
.store-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(255, 201, 71, 0.08);
    border: 1px solid rgba(255, 201, 71, 0.25);
}
.store-balance strong { color: var(--gold); font-family: Orbitron, sans-serif; }
.store-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: none;
}
.store-tabs button {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    color: var(--muted);
    font-size: 0.78rem;
    cursor: pointer;
}
.store-tabs button.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(255, 201, 71, 0.12);
}
.store-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.store-card {
    position: relative;
    border-radius: 14px;
    padding: 14px;
    background: rgba(12, 18, 32, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    transition: border-color 0.2s, transform 0.15s;
}
.store-card:hover { border-color: rgba(255, 201, 71, 0.35); }
.store-card--owned { border-color: rgba(93, 255, 176, 0.35); }
.store-card--equipped { box-shadow: 0 0 0 2px var(--gold); }
.store-card--locked { opacity: 0.92; }
.store-card__preview {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.store-card__preview .cos-preview-ring {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.5rem;
}
.store-card h3 { font-size: 0.9rem; margin: 0 0 4px; }
.store-card p { font-size: 0.72rem; color: var(--muted); margin: 0 0 10px; min-height: 2.4em; }
.store-card__price { font-family: Orbitron, sans-serif; color: var(--gold); font-size: 0.85rem; }
.store-card__owned { color: #5dffb0; font-size: 0.75rem; font-weight: 600; }
.store-card__actions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.store-card__actions .btn { width: 100%; font-size: 0.78rem; padding: 8px; }
.store-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(10, 14, 23, 0.95);
    border: 1px solid rgba(255, 201, 71, 0.4);
    color: var(--text);
    z-index: 9000;
    max-width: 90%;
    text-align: center;
}
.store-toast.error { border-color: var(--danger); color: #ff8a8a; }
.store-toast.ok { border-color: #5dffb0; }
