/* Avatar decorations — Discord CDN overlays
 * Discord client usa ~1.5×; su profilo Link-Hub 1.2× tiene l’alone
 * intorno al cerchio senza far “scoppiare” sabre/corone fuori scala.
 */
.lh-avatar-wrap {
    --lh-avatar-deco-scale: 1.2;
    overflow: visible;
}

/* Spazio per punte/impugnature che escono dal cerchio */
.lh-avatar-wrap:has(.lh-avatar-decoration:not(.hidden)) {
    margin-top: 0.35rem;
    margin-bottom: 1.35rem;
}

.lh-avatar-decoration {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--lh-avatar-size, 6rem) * var(--lh-avatar-deco-scale, 1.2));
    height: calc(var(--lh-avatar-size, 6rem) * var(--lh-avatar-deco-scale, 1.2));
    max-width: none;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 6;
    object-fit: contain;
    object-position: center;
    user-select: none;
    image-rendering: auto;
}

.lh-avatar-decoration.hidden {
    display: none !important;
}

/* Contieni la sezione dashboard: non far scoppiare il layout */
#sez-decorazioni,
#sez-decorazioni .lh-dash-section-body,
#sez-decorazioni .lh-deco-panel {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

.lh-dash-layout,
#lh-dash-form-col,
#form-dashboard {
    min-width: 0;
    max-width: 100%;
}

.lh-deco-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.lh-deco-head {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.lh-deco-head-preview {
    --lh-avatar-size: 3.25rem;
    --lh-avatar-ring: 2px;
    margin-bottom: 0;
    flex-shrink: 0;
    overflow: visible;
}

.lh-deco-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fafafa;
}

.lh-deco-sub {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: #a1a1aa;
}

.lh-deco-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 999px;
    background: #141414;
    border: 1px solid #262626;
    min-width: 0;
}

.lh-deco-search i {
    color: #71717a;
    font-size: 0.95rem;
}

.lh-deco-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: #f4f4f5;
    font-size: 0.92rem;
    outline: none;
}

.lh-deco-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.lh-deco-chips::-webkit-scrollbar {
    display: none;
}

.lh-deco-chip {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #2a2a2a;
    background: #171717;
    color: #e4e4e7;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lh-deco-chip:hover {
    border-color: #3f3f46;
}

.lh-deco-chip.is-active {
    background: #7e2c8b;
    border-color: #9c4dab;
    color: #fff;
}

.lh-deco-chip:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/*
 * Tile a misura FISSA (px): evita lo scoppio del grid da padding-% / img intrinsic size.
 * 695 decorazioni non devono mai allargare la colonna del form.
 */
.lh-deco-grid {
    --lh-deco-tile: 76px;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, var(--lh-deco-tile)) !important;
    grid-auto-rows: var(--lh-deco-tile);
    gap: 8px;
    justify-content: start;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: min(42vh, 360px);
    overflow-x: hidden !important;
    overflow-y: auto !important;
    align-content: start;
    box-sizing: border-box;
    padding: 2px;
    scrollbar-width: thin;
}

.lh-deco-tile {
    position: relative !important;
    display: block !important;
    box-sizing: border-box !important;
    width: var(--lh-deco-tile) !important;
    height: var(--lh-deco-tile) !important;
    max-width: var(--lh-deco-tile) !important;
    max-height: var(--lh-deco-tile) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 4px !important;
    border-radius: 14px;
    border: 2px solid #1f1f1f;
    background: #121212;
    cursor: pointer;
    overflow: hidden !important;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.lh-deco-tile:hover {
    border-color: #3f3f46;
}

.lh-deco-tile.is-selected {
    border-color: #c265e0;
    background: rgba(156, 77, 171, 0.14);
    box-shadow: 0 0 0 1px rgba(194, 101, 224, 0.25);
}

.lh-deco-tile.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.lh-deco-tile[hidden] {
    display: none !important;
}

.lh-deco-tile-preview {
    position: relative !important;
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #3f3f46 0 33%, transparent 34%),
        #0a0a0a;
    overflow: hidden !important;
}

.lh-deco-tile-preview img,
.lh-deco-tile-preview video,
.lh-deco-grid .lh-deco-tile img,
.lh-deco-grid .lh-deco-tile video {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    transform: none !important;
    object-fit: contain !important;
    object-position: center !important;
    pointer-events: none !important;
}

.lh-deco-tile.is-none .lh-deco-tile-preview {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #18181b;
    color: #71717a;
    font-size: 1.1rem;
}

.lh-deco-tile-prem {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(126, 44, 139, 0.85);
    color: #f5d0fe;
    font-size: 9px;
    z-index: 2;
}

.lh-deco-empty {
    margin: 0;
    text-align: center;
    color: #71717a;
    font-size: 0.88rem;
    padding: 18px 8px;
}

@media (max-width: 640px) {
    .lh-deco-grid {
        --lh-deco-tile: 68px;
        gap: 6px;
        max-height: min(38vh, 300px);
    }

    .lh-deco-head-preview {
        --lh-avatar-size: 2.75rem;
    }
}
